Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Advanced Terrain Texture SplatMap

Author
Message
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 6th Dec 2018 17:50 Edited at: 7th Dec 2018 03:52
Converting Andrey Mishkinis' code from http://www.gamasutra.com/blogs/AndreyMishkinis/20130716/196339/Advanced_Terrain_Texture_Splatting.php

The image files need to have the depth information in the alpha channel. This can be done in GIMP by adding a LayerMask based off grey scale or pasting in a the height map.

Using three different images, you can see the grass/ground is below the "rocks" instead of getting a boring blend. And vice versa with the cliff slope texture.



PS Example File - The VS file is just normal file


Thoughts?

Attachments

Login to view attachments
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 6th Dec 2018 21:28 Edited at: 6th Dec 2018 21:29
Nice work Golelorn!
I always wanted to implement this, you did it well

Is it possible to add N blending curves by the use of an array?
If so, we could merge this into the 16 textures splatmap shader we did here months ago, so we will have the perfect splatmap shader,
with multiple textures and non linear blending!
Forum Url:
https://forum.thegamecreators.com/thread/222752

[/url]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Dec 2018 21:45 Edited at: 6th Dec 2018 21:49
That looks sweet! Much better than a blend
puzzler2018
User Banned
Posted: 6th Dec 2018 21:53
Attention to detail is really super high for Golelorn - which is perfectly ok too for a super impressive app.

Keep up the good works - but this time round, im out of ideas of why this could be happening
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 7th Dec 2018 03:10
impressive! i like it
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 7th Dec 2018 03:42
Quote: "Is it possible to add N blending curves by the use of an array? "


I will be honest. I don't know what that means... lol.

My next task is to implement Parallax Mapping. I hope to give an update tomorrow if anyone is interested.
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 8th Dec 2018 03:04 Edited at: 8th Dec 2018 03:40
I converted the Parallax and NormalMap from https://learnopengl.com/Advanced-Lighting/Parallax-Mapping.

Definitely a few errors that I need to work out. I am not sure if its caused by my splatmap or an increase in the vertices height.

Let me know what you think? I can share code for those interested. The only part I can't share came from Janbo's shader of grabbing a tanget value. I think he has it somewhere on the forums if you look hard enough.



edit: Here is another good simplified tutorial https://codea.io/talk/discussion/7642/parallax-mapping-on-codea-opengl-es-2-0. I really like this one.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 8th Dec 2018 03:43
It looks great! A very natural transition
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 8th Dec 2018 03:57 Edited at: 8th Dec 2018 03:58
Thanks, Blink. I made a few more adjustments. I am really loving this. Plus, the FPS is pretty damn good for my crappy machine(100 FPS with no water and 70FPS with water). That's not even trying to integrate this into Jack's AGKMegaSplatter(this is what I call it in my mind).
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 8th Dec 2018 13:19 Edited at: 8th Dec 2018 16:38
Hi,

did you already tried to use SetObjectAlphaMask( objID, 1) for your trees so you get nice shadows for the leafs ?
I also highly encourage you to find a math solution for your shader which doesn't include many if's(branching) as you care about performance.
Sounds like you are focusing on perfecting your engine to build on it, keep it up.

[Edit]
One more thing:
Did you also build a transpose matrix for the Parallax effect?
If not can your objects rotate ?

[/Edit]

Attachments

Login to view attachments
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 8th Dec 2018 22:41
Yes sir. I do build a transpose Matrix. I have not tried to rotate it.

Ah, thanks for the tips about branching, and the alphamask! I had no idea alphamask had that effect!
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 9th Dec 2018 10:14
I had trouble getting my objects to rotate without screwing up the parallax effect, thats why I asked.

Look into the Terrain example demo from Paul which is shipped with AppGameKit, there he is doing this kind of magic without branching.
Must be doable with for your project too.
Find the Demo in: AGK\Tier 1\Examples\3D\media\Terrain.vs
I'm happy to help and I'm watching this thread
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 9th Dec 2018 20:44 Edited at: 9th Dec 2018 20:45
Comparison of rocks with and without parralax mapping.

Without:


With:

Attachments

Login to view attachments
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 10th Dec 2018 22:42 Edited at: 12th Dec 2018 19:36
Jack,

I have attached a version of your 16 texture megasplat version. I'm only using 8 textures for this test version, so I have adjusted it for what I am using. You should be able to piece it back together easily enough.

I get 80FPS with Normal Parrallax, 100 FPS with just Normal Mapping and 140 FPS with no normal mapping.

Let me know if you get a chance to mess around with it. BTW, I am using a 4K sized atlas texture, and I get no seams.

ps file


vs file


edit: I made a typo on the TBN matrix. Also added 'the Gram-Schmidt process". Source: https://learnopengl.com/Advanced-Lighting/Normal-Mapping

Login to post a reply

Server time is: 2024-04-16 16:43:58
Your offset time is: 2024-04-16 16:43:58