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.

DarkBASIC Professional Discussion / UV tiling based on distance from camera HLSL

Author
Message
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 14th Sep 2013 05:24
I'm trying to write a HLSL shader that will have more detail up close and less detail further away. I want to do this by having the texture tile more up close and gradually reduce the number of times it tiles the further it is away from the camera.

This is for a terrain shader that I'm working on. Does anyone have any ideas. I'm all out.

I tired to use a the basic "fog" principle and use it to compute the tiling amounts. The fog part works great as expected but as soon as I try to apply it to the UV portion. such as In.Tex * tileAmount; funny things happens the textures seem to move over the ground depending on when your moving the camera around. This does not make much sense.

Also I have tried to take the nearPlane and FarPlane and work with those, but again I am having limited results and again the texture seems to move around. Also, This method works good for fog but that doesn't apply to what I want to do, only as a way to test what I thought should have been happening was.

I'm out of ideas, so here is the code I'm using.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Sep 2013 13:46
This might be of interest:

high detail texturing



Powered by Free Banners
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 15th Sep 2013 02:53
Thanks I'm looking into it now.
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 15th Sep 2013 04:04
Hey that is exactly what I am looking for!

As always THANK YOU!

You have no idea how crazy that was driving me. YAY!!!!!!
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 16th Sep 2013 06:57
GG I just wanted to show you a screenshot of the results.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Sep 2013 11:16
Looks good. Thanks.



Powered by Free Banners
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 17th Sep 2013 04:08
Can has snow peaks?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 17th Sep 2013 06:07
Sure why not, you just have to adjust for the height of the land and add snow to them instead of just using slope like I am.

Add something like this to the shader and you will get a value for height that you can use.

You can use a combination of slope and height to determine what textures get blended in what locations

Login to post a reply

Server time is: 2026-07-07 00:50:08
Your offset time is: 2026-07-07 00:50:08