Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

gotta watch out for side-stretching #2

Open
pgruenbacher opened this issue Jul 27, 2018 · 8 comments
Open

gotta watch out for side-stretching #2

pgruenbacher opened this issue Jul 27, 2018 · 8 comments

Comments

@pgruenbacher
Copy link

image

we'll need to come up with some sort of angle-threshold

@leopoldek
Copy link
Owner

Just leaving this here as a note: since Godot does not let you access the normal buffer, I was hoping I could use the depth buffer and take the derivative of that to get the normal of the screen and then from there I can implement angle-threshold.

@pgruenbacher
Copy link
Author

that sounds somewhat fragile. This may just need to be a thing that the developer should watch out for when designing.

@Mr-Slurpy more importantly, have you thought of a way to isolate the decal to specific surfaces or meshes? E.g. if I draw a puddle splatter on a floor, if my 3d character steps on it, then the splatter would also render on the character's feet. Ideally this should only be drawn over the direct parent meshes.

This link doesn't highlight the issue. For some reason I've had a hard time finding out why it's not a mentioned issue.
https://bartwronski.com/2015/03/12/fixing-screen-space-deferred-decals/

@pgruenbacher
Copy link
Author

https://mtnphil.wordpress.com/2014/05/24/decals-deferred-rendering/

Ah this blog mentions the problem. Two solutions. Draw dynamic moving objects afterwards. Not ideal.
Or have an object id buffer that the shader can compare against, so that it only writes to pixels that are part of the geometry(s) we care about. Alpha rendering won't work but /shrug.

@leopoldek
Copy link
Owner

I think the only way to not do decal render on only specific objects would be to just render them after the decal. I don't think it's that difficult since Godot lets you specify the render order of your materials. So you could set the scene to render priority of 0, the decal to 1 and dynamic objects to 2.

The other solution is nice but it has some problems. To do that you would have to render the entire scene to a separate buffer (preferably a stencil buffer (which Godot doesn't support)) and in Godot this is very gimmicky. You would also limit the amount of unique objects you can display but it's such a high cap that it's just a nitpick. I think right now the above solution will do for now.

And even though admittedly my fix for the angle-threshold is a little hacky, I'd still like to try it. At the very least I can make it an optional addition if users don't like the behavior. (Of course, the angle would be adjustable.)

@pgruenbacher
Copy link
Author

hm I didn't get much luck with the render priority. It seems the depth disabled option will override the render priority. However if I do set the character material to have ALPHA being detected it will render. I haven't figured out in the godot code how the use_alpha would be affecting the rendering pipeline.

screenshot from 2018-08-08 22-09-45

@pgruenbacher
Copy link
Author

http://blog.wolfire.com/2009/06/how-to-project-decals/
http://blog.wolfire.com/2009/05/decals-editor-part-one/

I also wonder whether the mesh generation method would be fast-enough if it took advantage of the CSG module.

@pgruenbacher
Copy link
Author

https://pompidev.net/2014/12/02/projecting-a-dynamic-decal-on-a-3d-mesh/

more notes to myself. Sorry for the spam.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants