stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.45k stars 933 forks source link

Feature: Decals #24

Open xen2 opened 6 years ago

xen2 commented 6 years ago

Used extensively in games, decals will be needed at some point.

Aggror commented 2 years ago

open collective page. Will be updated once we have all the deliverables and a possible budget: https://opencollective.com/stride3d/projects/decals

Eideren commented 2 years ago

Deliverables:

There are a couple of papers and implementation flying around, the latest DOOM for example has a lot of resources on their version

Aggror commented 2 years ago

Thanks for the input Eideren.

Bonus:

tamamutu commented 1 year ago

Interested in giving this a try, I can sort out a WIP PR when I have some time over the next couple days if there's interest. Was a mesh generation approach what you were after in terms of the implementation?

Eideren commented 1 year ago

Hey @tamamutu thanks for looking into this, decals as mesh can be a very powerful tool for level design, but issue is that for impact decals and other more dynamic uses it may take too much time at runtime doing the boolean operation to extract the mesh. If you're confident that spawning one decal on a moderately complex mesh would take less than 0.2ms I think you can go ahead with your idea. Otherwise you might have to look into implementing them through sampling the depth buffer.

Ethereal77 commented 1 year ago

Currently the standard I think is projective decals, commonly implemented as deferred decals (see this page. They are even optimized in modern engines using tricks similar to those of tiled or clustered shading (dividing the screen or the frustum in tiles and rendering the decals of each tile, which massively helps for a high number of decals). Look for clustered decals or D-Buffer if you want to know more.

Also, the people at CIG (those which make Space Citizen) have also implemented a type of geometry decal that does not dynamically computes its geometry. Instead it is static geometry like any other mesh, but it is rendered with a special shader that samples the G-Buffer and writes to the output buffer without modifying depth (to avoid Z-fighting). They use them for trims, lines, dents, bolts, etc. to give a huge amount of detail to relatively simple geometry without much complexity or performance loss. It's pretty interesting indeed.

Dynamic mesh decals are a niche nowadays I believe. The majority of use cases can be covered by those other two I've mentioned. Obviously it has its uses where it can excel, but would be nice just as a bonus, not as a priority. Also it is the harder to implement in my opinion.