Archive 17/01/2023.

Is there a Technique that supports surface displacement?

ToolmakerSteve

Looking at Basic Techniques sample scene, I don’t see any that actually displace the surface of a model.

Nor do I see any mention in the Techniques folder.

I’m making a Stone Wall. Normal map works - but would love to have actual depth to its surface - the fakeness of the wall is obvious, especially on the top.

I’ve got a “displacement” image - just need a way to make use of it.

Recommendations?

OR are there modeling tools out there that can take the “displacement” image, and make a 3D model from it, that would make the wall more realistic? I would need a way to specify how many polygons are okay.

And there probably will be issues where the side meets the top - but one step at a time!

Modanung
ToolmakerSteve

Thanks! Sounds like what I was hoping for. Trying it out now. (I’m using OpenGL)

ToolmakerSteve

I replaced CoreData/Shaders/GLSL/LitSolid.glsl with this one.

When ran, got this exception:

"Failed to compile vertex shader LitSolid(DIRLIGHT INSTANCED NORMALMAP PARALLAX PERPIXEL SHADOW):\nERROR: 0:1086: ‘=’ : cannot convert from ‘4-component vector of highp float’ to ‘3-component vector of highp float’\nERROR: 0:1102: ‘GetShadowPos’ : no matching overloaded function found (using implicit conversion) \nERROR: 0:1102: ‘GetShadowPos’ : function is not known \nERROR: 0:1101: ‘assign’ : cannot convert from ‘const highp float’ to ‘4-component vector of highp float’

NOTE: I’m running via urho.Net.

elix22

This is an old Sample using an old LitSolid.glsl shader
You are mixing old shaders with new ones (Urho.Net is using the new ones)
The signature for GetShadowPos() did change (in Lighting.glsl)
vec4 GetShadowPos(int index, vec3 normal, vec4 projWorldPos)

I would advice you to use the matching native part of Urho.Net. for your development.
For windows compilation use the scripts in the scripts folder
Urho3D/build_vs2019_dotnet_dll.bat at dotnet · elix22/Urho3D · GitHub

Also look at a more recent and working implementation

ToolmakerSteve

Thank you elix. I’m seeing visual artifacts using these parallax shaders.

Occlusion: thin “contour lines” visible - is this expected? fixable?

Offset: no depth at all, instead, textures distort:

This is on standard Box model. Same behavior if apply to my wall. It also happens using the various offset/occlusion materials and textures provided in that repo.

Windows 10, OpenGL, Urho.Net.

In case it was something else in that scene, I’ve also tested in a simple scene, with nothing but a ground plane and some Boxes, a simple directional light, no shadows.

If approach any of 6 faces of box straight on, the texture looks perfect. As increase camera angle relative to plane of the surface, those distortions appear/increase.

elix22

Hmm …
I quickly added this sample to the feature-samples (literally took less the 5 minutes)
Well it’s Parallax mapping , just gives an illusion of depth (check the sample below in the link ) .
Samples/FeatureSamples/Source/Parallax at main · Urho-Net/Samples · GitHub

I guess you want a real displacement mapping , with real depth ?
This sample contains another scene TerrainScene.xml created by the same author , some combination of height map + Parallax map

George1

I think parallax offset has some artifacts at high viewing angle. Maybe leave a message to Lumak on his Git.