Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,633 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using depthmap in object shader #362549
03/08/11 19:05
03/08/11 19:05
Joined: Nov 2008
Posts: 946
T
the_clown Offline OP
User
the_clown  Offline OP
User
T

Joined: Nov 2008
Posts: 946
Another dumb question regarding shaders, but meh.

I already do calculate a depthmap for use in a depth of field post processing shader. Now, I wanna use the same depthmap in a terrain shader to allow some kind of dynamic lod system. What I basicly wanna do is blending out detail maps depending on the distance to the camera. I however do not wanna use lod techniques, because I want to have different lod stages for a single model/terrain.

But in general, can I use a processed bitmap, as the depthmap, in an object shader?

Re: Using depthmap in object shader [Re: the_clown] #362577
03/08/11 19:59
03/08/11 19:59
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
I don't see why you shouldn't be able to do this. You just have to define a sampler with the depthmap as a texture. You should however keep in mind that the depthmap is then from the previous frame.

However, I think it would be easier to transform the objects vertices in a vertex shader to camera space. You then already have the depth of the objects vertices in their z coordinate. Compared to the depthmap solution you have up to date data and don't need to do the texture lookup. So the depthmap solution is something like a detour for something you need to do anyways in a vertex shader.


Always learn from history, to be sure you make the same mistakes again...
Re: Using depthmap in object shader [Re: Uhrwerk] #362713
03/09/11 13:40
03/09/11 13:40
Joined: Nov 2008
Posts: 946
T
the_clown Offline OP
User
the_clown  Offline OP
User
T

Joined: Nov 2008
Posts: 946
Ahh, of course, why didnt I see this.. all I got to do is re-calculating the depth in the vertex shader, of course, thank you. It's so easy...


Moderated by  Blink, Hummel, Superku 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1