Parallax Mapping

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Parallax Mapping

Post by UsernameAK »

I suggest to add Parallax Mapping support to GZDoom material system. That will make possibility to make even more realistic materials.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: Parallax Mapping

Post by Kinsie »

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.

Image
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.

Image
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!
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Parallax Mapping

Post by Chris »

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.

Image

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.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Parallax Mapping

Post by RockstarRaccoon »

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...
User avatar
Dark-Assassin
Posts: 742
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: Parallax Mapping

Post by Dark-Assassin »

Could take the parallax a step up and use relief mapping.
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Parallax Mapping

Post by UsernameAK »

Mappers will able to do parallax mapping themselves if this will be accepted: https://github.com/coelckers/gzdoom/pull/515
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Parallax Mapping

Post by Graf Zahl »

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.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Parallax Mapping

Post by Nash »

UsernameAK wrote:Mappers will able to do parallax mapping themselves if this will be accepted: https://github.com/coelckers/gzdoom/pull/515
Just some minor feedback -

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.
User avatar
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

Post by Matt »

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?
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Parallax Mapping

Post by Nash »

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?
It's just a texture/pixel shader so no, no collision. It's purely visual only.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

Re: Parallax Mapping

Post by ZZYZX »

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.
Note that the primary texture name is hardcoded as well in the internal include file (as "tex")
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Parallax Mapping

Post by UsernameAK »

Nash wrote:
UsernameAK wrote:Mappers will able to do parallax mapping themselves if this will be accepted: https://github.com/coelckers/gzdoom/pull/515
Just some minor feedback -

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.
1) Yes, I'll fix that.
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.
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Parallax Mapping

Post by UsernameAK »

First screenshot. The shader doesn't look good at all. At least now.
Attachments
Снимок экрана от 2018-07-05 15-04-23.jpg
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Parallax Mapping

Post by Nash »

UsernameAK wrote: UPD: made an additional feature to be able to make custom materials.
Care to elaborate? Are you saying you made it possible to combine together hardware shader with materials now (diff/spec/norm or PBR)?
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Parallax Mapping

Post by UsernameAK »

Nash wrote:
UsernameAK wrote: UPD: made an additional feature to be able to make custom materials.
Care to elaborate? Are you saying you made it possible to combine together hardware shader with materials now (diff/spec/norm or PBR)?
Almost. If i'll make ability to name the textures, yes. Before that you have to copy the material and change texture uniform names.
Post Reply

Return to “Feature Suggestions [GZDoom]”