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,449 guests, and 6 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
Page 1 of 2 1 2
"Fog cubes" and depth sorting! #65171
02/28/06 02:08
02/28/06 02:08
Joined: Aug 2002
Posts: 681
Massachusetts, USA
Ichiro Offline OP
User
Ichiro  Offline OP
User

Joined: Aug 2002
Posts: 681
Massachusetts, USA
Howdy. I have an enormous, semi-transparent, hollowed-out cube that I use to tint the sky a particular color. This works well, but I notice that it appears in front of other transparent objects (presumably due to depth sorting -- the cube follows the player around as he moves, so the center is right at the camera's coordinates). Is there an easy way to force the object to be drawn first, so that everything else appears over it?

Note: There are, of course, a number of other ways to handle this tinting; I'll eventually just paint over the skycube to tint it. But I thought I'd ask re: the depth sorting, since I'm just prototyping things.

Thanks!


Dejobaan Games - Bringing you quality video games for over 75 years.
Re: "Fog cubes" and depth sorting! [Re: Ichiro] #65172
02/28/06 02:45
02/28/06 02:45
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
I assume you have this cube placed at the camera position..

Then this sorting problem is natural, because transparent polygons are sorted by entitity position, not the Z-buffer. So think about this, if its x,y,z position is at the camera position, its always closest to the camera, and will generally be drawn on top of other transparent entities, not behind as you want.

Setting aside the fact that it's not the best idea to use a transparent cube in this way, as I'm sure you know, there is no easy way to solve this sorting problem . To do so you would need to render it in a DLL, using the 'render_sky' event. This way you could ensure that it's drawn before all other entities..(of course then I think it would be drawn before the skybox too, so you have another, worse problem).

So basically, this isnt going to work. if you want to tint your sky box, there is a much better to way.. do it with a very simple pixel shader. That way you could change it's tint at runtime to simulate changing time of day, weather, etc.


Sphere Engine--the premier A6 graphics plugin.
Re: "Fog cubes" and depth sorting! [Re: Matt_Aufderheide] #65173
02/28/06 04:12
02/28/06 04:12
Joined: Aug 2002
Posts: 681
Massachusetts, USA
Ichiro Offline OP
User
Ichiro  Offline OP
User

Joined: Aug 2002
Posts: 681
Massachusetts, USA
Aha! Ultimately, I was going to just modify the skycube's bitmap at runtime, but shaders would probably be even better, thanks.


Dejobaan Games - Bringing you quality video games for over 75 years.
Re: "Fog cubes" and depth sorting! [Re: Ichiro] #65174
02/28/06 07:21
02/28/06 07:21
Joined: Feb 2006
Posts: 28
Australia
Blood Offline
Newbie
Blood  Offline
Newbie

Joined: Feb 2006
Posts: 28
Australia
Maybe would work if you set its "layer" lower than other entities.

In the manual...

Elements with higher layer value will be placed over elements with lower layer value. Elements with the same layer value are sorted due to the z buffer

entity shotgun_onscreen
{
type = <shotgun.mdl>;
layer = 2; // display above view entities with layer 1
flags = visible;// visible on screen from the start
view = CAMERA; // same camera parameters as the default view
albedo = 50; // gouraud shading from sun position
x = 100; // place 100 quants ahead of the view
y = -50; // 50 to the right
z = 0; // and center vertically
}


Another you could try would just be a flat transparent sprite infront of camera and use layers. Goodluck


( It is better to conceal one's knowledge than to reveal one's ignorance. )
Re: "Fog cubes" and depth sorting! [Re: Blood] #65175
02/28/06 17:06
02/28/06 17:06
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
No that wont work as he is not using a view entity, but a real entity.


Sphere Engine--the premier A6 graphics plugin.
Re: "Fog cubes" and depth sorting! [Re: Matt_Aufderheide] #65176
02/28/06 21:24
02/28/06 21:24
Joined: Jul 2000
Posts: 8,973
Bay Area
Doug Offline
Senior Expert
Doug  Offline
Senior Expert

Joined: Jul 2000
Posts: 8,973
Bay Area
Just an idea (haven't tested it), but instead of making the center of the cube the center point of the model, put the center point on one of its edges (i.e. a cube with sides of 200 units would be centered at 100,0,0).

This is hard to explain in words, but a picture would be easy.

This might not work, but its worth a try.


Conitec's Free Resources:
User Magazine || Docs and Tutorials || WIKI
Re: "Fog cubes" and depth sorting! [Re: Doug] #65177
03/01/06 00:33
03/01/06 00:33
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Yeah that would probably work, except if you have transparent ents further away than that.


Sphere Engine--the premier A6 graphics plugin.
Re: "Fog cubes" and depth sorting! [Re: Matt_Aufderheide] #65178
03/01/06 15:42
03/01/06 15:42
Joined: Jun 2005
Posts: 656
G
Grafton Offline
User
Grafton  Offline
User
G

Joined: Jun 2005
Posts: 656
Or, a variation of Doug's idea(?), move the origin of the cube to the center of
the far side that will be in front of the camera in MED. Then assuming the cube
is say 20000 per side, the cube should be kept 10000 quants in front of the
camera so the camera is still in the center of the cube and the cubes origin is
always 10000 quants in front of the camera. (like this;)

Code:

action tint_cube
{
while(me)
{
vec_set(temp, vector(10000,0,0)); // create offset with temp
vec_rotate (temp, camera.pan); //pan temp same as cameras pan
vec_add (temp, camera.x); // add cameras position to offset
vec_set (my.x, temp.x); // put me there
wait(1);
}
}



Last edited by Josiah; 03/01/06 15:44.

Not two, not one.
Re: "Fog cubes" and depth sorting! [Re: Grafton] #65179
03/02/06 03:37
03/02/06 03:37
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
tint the sky

try using a totaly semi transparent solid color ( like white set to 50%)
for your skybox texture ( be sure its flagged SKY when you apply it to the skybox)
now set your background colors (bg_color. ) to set a sky color tint ( remeber to adjust sunlight color also to help properly reflect the overall level lighitng color)

Edited: any sky texture you use over the background ( like domes ) you then want transparent or overlay areas in the image to allow the BG_color to com through

some shots I did of just the above thing. forground Im using a model with the same 50% white transparent image as the box model skin. a skybox set with the same 50% white texture flagged with sky applied to the walls and cieling of this holow cube ( floor of cube is the floor textured block you see)



for the sort issue I've found it you just don't combine a semi-transparent and full opaque in the same skin image then things seem to work ok then.

Last edited by Grimber; 03/02/06 03:40.
Re: "Fog cubes" and depth sorting! [Re: Grimber] #65180
03/02/06 04:01
03/02/06 04:01
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
I did anotehr example test for the semi transparent sort stuff.

with the new changes in MED. group parts of the model that will have OPAQUE skin. group triangles of the model that need an transparent skin. then apply differnt skin texture to each group


I duplicated the cube in the model itself, deleted teh faces where the 2 cubes meet. set each cube as a differnt group. one gave the 50% transparent white skin, other half gave is some bad wood texture I had ( differnt image formats btw. 32 bit tga and 24 bit bmp)

ill play around with anotehr example If I can find a nice car model, give its windows seperate grouing and apply a transpeent image

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

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