Was scrolling through reddit and saw this thumbnail and thought "no way can they explain that in under 5 minutes"....I was wrong...O_O. You're awesome!!!
Imagine people in the future laughing at such hacks and just throwing in thousands and millions of vertices... (this has already happened to a number of techniques in 3D graphics world).
at 4:01 - is the vector (0,0,1) within the dot product (third argument of mix) not going to restrict the occlusion to one specific direction? Wouldn't it be more suitable to dot against the normal for that fragment?
true , you can use the fragment normal instead of (0,0,1) , he did this only because the brick wall was facing the direction of (0,0,1) as an example for the video
This is very helpful and well explained. Sadly, this doesn't work with a procedural generated height map, does it? Or at least not, without recalculating the (in my case, expensive) height map calculation for each layer.
Should work just fine. But keep in mind the use cases for it. You would not use this to render terrain for example. More like a miniature map or something like that. Also, you can just render the heightmap to a texture and give that to the shader, should work just fine without any significant impact on performance ;)
@@VictorGordan Thank you for your quick reply :D I got your shader up and running perfectly well, using a 2D texture as heightmap. But im having a hard time replacing the texture with my procedual heightmap, since we sample the texture with "different" UVs for each loop (because we do UVs -= deltaUVs within the loop). To sample my heightmap, i would also have to include the entire heigtmap calculation to the loop. You don't happen to know a need little trick to avoid that problem, do you? :D
I'm not quite sure what the problem is... if you write your heightmap into a texture, then when the shader will read that texture just as any other texture. It's ok if the UVs are different. Nothing is getting recalculated in the texture. If you are generating a dynamic heightmap each frame on the GPU, then just make that a separate shader from the parallex shader and save the result as a texture. Perhaps I'm misunderstanding something? 🤔
@@VictorGordan I should have mentioned that we intended to use this effect on runtime random generated buildings with huge surfaces. We are covering texture repetition with noise based damages on the wall, making up the heightmap. We would have to draw thousends of textures, each with a very high resolution, to cover a whole city. Im arfraid writing the heigtmap into a texture is not an option :/ But you can't imagine how much i apprecciate your help anyways :D thank you a lot sir
Ah ok, I see the problem now. Yeah that's more complicated, I can't give you a solution for that without knowing many more details... good luck tho! ;)
I am curious whether it'd be possible to gradually change into this starting with an actual displacement map and then towards a normal map. That might be a pretty effective gradual LOD system.
I'm pretty sure that is possible and I think it is done in modern games, though it's not always that smooth. If you just put an if statement you can just change between the two at a certain distance. If you want to do a smooth transition you would have to calculate both of them and then interpolate. But it shouldn't be a problem since even with the displacement you are still likely to use the normal map anyway
Generally speaking you mainly just don't want to allow the viewer to get at a small angle camera with the plane. So you would normally use this for the ground, or walls that have pillars in the corners for example. I don't know of any specific fixes off the top of my head. But if you google some I'm sure you'll find papers on this subject which might have some optimizations ;) Good luck!
There is no such thing as a parallax model. It's also in the texture, not the model. I suggest rewatching the theory part of the video to make sure you understand what's actually happening behind the scenes
There is no such thing as a parallax texture. You use the heightmap to create a parallax effect. The effect doesn't work that great on models though, so I suggest keeping it to flat surfaces ;)