Parallax Mapping
Moderator: GZDoom Developers
- UsernameAK
- Posts: 83
- Joined: Wed Jul 15, 2015 5:26 am
- Location: Ukraine
Parallax Mapping
I suggest to add Parallax Mapping support to GZDoom material system. That will make possibility to make even more realistic materials.
- Kinsie
- Posts: 7399
- Joined: Fri Oct 22, 2004 9:22 am
- Graphics Processor: nVidia with Vulkan support
- Location: MAP33
- Contact:
Re: Parallax Mapping
Examples of what parallax mapping is and how it could benefit GZDoom projects would only make it easier to convince someone to add this.
To cut a long story short, parallax mapping is kind of like good old fashioned bump mapping in a way, but with a far greater illusion of depth, allowing for the faking of far greater geometry detail than is actually present, without as much of an impact on the GPU.
A fairly extreme of parallax mapping from the Source Engine documentation. The walls are just flat, the illusion of the depth between bricks is provided via parallax mapping and a heightmap texture.
A particularly cheeky example from Mass Effect - the stairs are a flat slope with parallax mapping applied to make them look like individually modelled stairs!
To cut a long story short, parallax mapping is kind of like good old fashioned bump mapping in a way, but with a far greater illusion of depth, allowing for the faking of far greater geometry detail than is actually present, without as much of an impact on the GPU.
A fairly extreme of parallax mapping from the Source Engine documentation. The walls are just flat, the illusion of the depth between bricks is provided via parallax mapping and a heightmap texture.
A particularly cheeky example from Mass Effect - the stairs are a flat slope with parallax mapping applied to make them look like individually modelled stairs!
- Chris
- Posts: 2940
- Joined: Thu Jul 17, 2003 12:07 am
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Parallax Mapping
More generic support for height-mapping could be nice. For older or weaker cards, parallax mapping can be applied in a pixel shader, while less ancient cards can use adaptive hardware tessellation with geometry shaders. The latter works better with depth-related effects (like ambient occlusion, global illumination, and such) and with surface edges, since the actual geometry is displaced in the scene and isn't just texture coordinate displacement.
Not only is more geometric detail added nearer to the camera (not wasting computation time with farther surfaces where you couldn't so easily see the difference anyway), but even the shape and silhouette of the road and steps are changed, with the light and shadows correctly interacting with it.
Not only is more geometric detail added nearer to the camera (not wasting computation time with farther surfaces where you couldn't so easily see the difference anyway), but even the shape and silhouette of the road and steps are changed, with the light and shadows correctly interacting with it.
- RockstarRaccoon
- Posts: 598
- Joined: Sun Jul 31, 2016 2:43 pm
Re: Parallax Mapping
While this is something I've been kind of wanting for a while, and could probably be implemented using the existing height and normal maps, I'm not sure how much work it would actually take to code: Parralax Mapping is a very sophisticated thing. Then again, I've never used it, so it may just be another could GL calls...
Knowing how many projects actually utilize normal mapping right now, I don't think this is important enough to prioritize right now, but I will note that I'm one of the people who would probably use it if it were in there.
Edit: I guess another thing I'd note is, if this could be applied to sloped 3D floors, it would make 3D floor stairs much easier to build...
Knowing how many projects actually utilize normal mapping right now, I don't think this is important enough to prioritize right now, but I will note that I'm one of the people who would probably use it if it were in there.
Edit: I guess another thing I'd note is, if this could be applied to sloped 3D floors, it would make 3D floor stairs much easier to build...
- Dark-Assassin
- Posts: 742
- Joined: Thu Mar 19, 2009 3:40 am
- Location: South Australia
Re: Parallax Mapping
Could take the parallax a step up and use relief mapping.
- UsernameAK
- Posts: 83
- Joined: Wed Jul 15, 2015 5:26 am
- Location: Ukraine
Re: Parallax Mapping
Mappers will able to do parallax mapping themselves if this will be accepted: https://github.com/coelckers/gzdoom/pull/515
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Parallax Mapping
It will have to be reviewed first and I won't be able to do that before the next weekend (14./15. July) so it may collect some dust first.
Re: Parallax Mapping
Just some minor feedback -UsernameAK wrote:Mappers will able to do parallax mapping themselves if this will be accepted: https://github.com/coelckers/gzdoom/pull/515
1) The brace style in gldefs.cpp is inconsistent. Would rather you stick to Allman, like the rest of the file.
2) Would be better if the Sampler2D variable names aren't hard-coded as texture2, texture3, texture4 etc. Should allow users to name their own variables.
3) The max texture limit of 15 seems very arbitrary. Why 15? I know 15 custom textures per shader is crazy but should just let the user define as many as they can until they run out of memory. Note: I may be missing something important here so feel free to correct me if I'm wrong.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Parallax Mapping
Technical illiterate question time: would this affect collisions at all? Especially if someone did the stairs thing - would a hitscan go through the stair bump, or would it register as hitting it?
Re: Parallax Mapping
It's just a texture/pixel shader so no, no collision. It's purely visual only.Matt wrote:Technical illiterate question time: would this affect collisions at all? Especially if someone did the stairs thing - would a hitscan go through the stair bump, or would it register as hitting it?
Re: Parallax Mapping
Note that the primary texture name is hardcoded as well in the internal include file (as "tex")Nash wrote:2) Would be better if the Sampler2D variable names aren't hard-coded as texture2, texture3, texture4 etc. Should allow users to name their own variables.
- UsernameAK
- Posts: 83
- Joined: Wed Jul 15, 2015 5:26 am
- Location: Ukraine
Re: Parallax Mapping
1) Yes, I'll fix that.Nash wrote:Just some minor feedback -UsernameAK wrote:Mappers will able to do parallax mapping themselves if this will be accepted: https://github.com/coelckers/gzdoom/pull/515
1) The brace style in gldefs.cpp is inconsistent. Would rather you stick to Allman, like the rest of the file.
2) Would be better if the Sampler2D variable names aren't hard-coded as texture2, texture3, texture4 etc. Should allow users to name their own variables.
3) The max texture limit of 15 seems very arbitrary. Why 15? I know 15 custom textures per shader is crazy but should just let the user define as many as they can until they run out of memory. Note: I may be missing something important here so feel free to correct me if I'm wrong.
2) Those definitions were made before I made that thing
3) There's internal OpenGL texture limit and it depends on GPU. The 16 is the minimum that is supported on all GPUs. So 15 custom textures.
UPD: made an additional feature to be able to make custom materials.
- UsernameAK
- Posts: 83
- Joined: Wed Jul 15, 2015 5:26 am
- Location: Ukraine
Re: Parallax Mapping
First screenshot. The shader doesn't look good at all. At least now.
Re: Parallax Mapping
Care to elaborate? Are you saying you made it possible to combine together hardware shader with materials now (diff/spec/norm or PBR)?UsernameAK wrote: UPD: made an additional feature to be able to make custom materials.
- UsernameAK
- Posts: 83
- Joined: Wed Jul 15, 2015 5:26 am
- Location: Ukraine
Re: Parallax Mapping
Almost. If i'll make ability to name the textures, yes. Before that you have to copy the material and change texture uniform names.Nash wrote:Care to elaborate? Are you saying you made it possible to combine together hardware shader with materials now (diff/spec/norm or PBR)?UsernameAK wrote: UPD: made an additional feature to be able to make custom materials.