Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 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 | chip programmers | 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