stride
stride copied to clipboard
Feature: Decals
Used extensively in games, decals will be needed at some point.
open collective page. Will be updated once we have all the deliverables and a possible budget: https://opencollective.com/stride3d/projects/decals
Deliverables:
- Projection on any arbitrary opaque geometry at the very least.
- Projecting a given stride material.
- Is an entity component, projection direction depends on the transform it is attached to.
- Both editor and runtime; decals should be visible through the editor viewport.
There are a couple of papers and implementation flying around, the latest DOOM for example has a lot of resources on their version
Thanks for the input Eideren.
Bonus:
- The FPS sample project implements decals with the gun/weapon script.
- The documentation is extended with description of Decals, what they are , usecase, how to set them up in the editor/by code.
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?
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.
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.