Terrain Height Manipulation

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Lax
Hobgoblin
Posts: 510
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 34

Re: Terrain Height Manipulation

Post by Lax »

Hi Nickak2003,

Yes normalmaps are broken. Could you share your solution? That would be great!

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image
Nickak2003
Goblin
Posts: 213
Joined: Thu Jun 10, 2004 4:19 am
x 20

Re: Terrain Height Manipulation

Post by Nickak2003 »

here is a repo of my current stuff

https://github.com/nicholaskomsa/ogre_t ... maps_fixed

Note that there is only a shader solution for hlsl

if you have any questions, let me know

could you post your code for the splatting in the other thread, please
Lax
Hobgoblin
Posts: 510
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 34

Re: Terrain Height Manipulation

Post by Lax »

ok thanks!

@dark_sylinc: Could you maybe port the hlsl implementation for normal map to glsl and metal?

I posted the code in the other thread.

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image
Lax
Hobgoblin
Posts: 510
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 34

Re: Terrain Height Manipulation

Post by Lax »

Hi all,

I integrated the solution of Nickak2003 for normal maps, and it works half way. It does crash sometimes and something really wrong with the lighting.
But the biggest issue is: Its a deeper modifaction in the terra source code and for the future it will become more and more complicated to maintain terra, as @dark_sylinc will integrate new features, fix bugs etc. and also the normal map solution does only work for hlsl shaders.

@dark_sylink: Would It be possible to integrate an official normal maps bug fix for terra? I think other users will need this too.

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image
User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 252
Joined: Wed Apr 23, 2014 3:49 pm
x 57

Re: Terrain Height Manipulation

Post by TaaTT4 »

Lax wrote: Sat Feb 20, 2021 10:14 pm @dark_sylinc: Could you maybe port the hlsl implementation for normal map to glsl and metal?
I've submitted a PR that address this issue. It has already been merged in master branch.
Image
Senior game programmer at Vae Victis
Working on Racecraft
Nickak2003
Goblin
Posts: 213
Joined: Thu Jun 10, 2004 4:19 am
x 20

Re: Terrain Height Manipulation

Post by Nickak2003 »

You're having crashes? I don't get crashes nor does the lighting seem wrong to me, how does it seem wrong?
User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 252
Joined: Wed Apr 23, 2014 3:49 pm
x 57

Re: Terrain Height Manipulation

Post by TaaTT4 »

Nickak2003 wrote: Sat Jun 05, 2021 6:11 pm You're having crashes? I don't get crashes nor does the lighting seem wrong to me, how does it seem wrong?
I'm sorry, but I didn't get your point :?
OGRE vanilla was crashing when a detail normal map was used in Terra material. The crash was caused by syntax errors in the pixel shader code (that my PR has fixed in a way very similar to what you've done here: https://github.com/nicholaskomsa/ogre_t ... maps_fixed). There's no need to provide a tangent texture to the shader since they're mathematically calculated.
The screenshot I posted has been taken after having applied the PR and using a donut-style normal map.
Senior game programmer at Vae Victis
Working on Racecraft
Nickak2003
Goblin
Posts: 213
Joined: Thu Jun 10, 2004 4:19 am
x 20

Re: Terrain Height Manipulation

Post by Nickak2003 »

TaaTT4 wrote: Mon Jun 07, 2021 8:43 am
Nickak2003 wrote: Sat Jun 05, 2021 6:11 pm You're having crashes? I don't get crashes nor does the lighting seem wrong to me, how does it seem wrong?
I'm sorry, but I didn't get your point :?
OGRE vanilla was crashing when a detail normal map was used in Terra material. The crash was caused by syntax errors in the pixel shader code (that my PR has fixed in a way very similar to what you've done here: https://github.com/nicholaskomsa/ogre_t ... maps_fixed). There's no need to provide a tangent texture to the shader since they're mathematically calculated.
The screenshot I posted has been taken after having applied the PR and using a donut-style normal map.
The product I'm working hasn't been getting crashes for me nor others. I was asking if it's crashing for you and under what circumstance.

I have not looked at the new code yet, but in the original shader code- which recalling partially from memory- I did see that there was some sort of special transformation matrix stuff which math or technique I was unaware of or thought erroneous. I edited it and added the tangent map and it worked out. Could you tell me what this technique is called or what changes exactly were made or why?
Nickak2003
Goblin
Posts: 213
Joined: Thu Jun 10, 2004 4:19 am
x 20

Re: Terrain Height Manipulation

Post by Nickak2003 »

How does the normal map seem messed up?
User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 252
Joined: Wed Apr 23, 2014 3:49 pm
x 57

Re: Terrain Height Manipulation

Post by TaaTT4 »

Nickak2003 wrote: Sat Jun 19, 2021 1:59 am The product I'm working hasn't been getting crashes for me nor others. I was asking if it's crashing for you and under what circumstance.
The terrain system was crashing (due to a syntax error in the pixel shader) as soon as you try to set a detail normal map in one of the four slots.
Nickak2003 wrote: Sat Jun 19, 2021 1:59 am I have not looked at the new code yet, but in the original shader code- which recalling partially from memory- I did see that there was some sort of special transformation matrix stuff which math or technique I was unaware of or thought erroneous. I edited it and added the tangent map and it worked out. Could you tell me what this technique is called or what changes exactly were made or why?
I suppose you're referring to the TBN matrix. It serves to transform normal map values from tangent space to a different space such that they're aligned with the surface's normal direction. See here (especially the "Tangent space" paragraph) https://learnopengl.com/Advanced-Lighti ... al-Mapping for an in-deep explanation.
Senior game programmer at Vae Victis
Working on Racecraft
Post Reply