Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
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
2 registered members (AndrewAMD, Ayumi), 903 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
skyspheres, z-buffer and clipping #319696
04/16/10 21:21
04/16/10 21:21
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
I've searched pretty thouroughly (I think) and found much discussion but little resolution on this topic; and I wonder if maybe it has been solved since those threads were posted several years back:

how can I set up my sky sphere so that it does not appear to intersect level geometry or LOD terrain? Can I tell the engine to render objects that are actually beyond the skysphere model as between the skysphere and the camera, through some trick of the z-buffer? Or would I be better of scaling my skysphere model so that its radius is the clipping distance, and using fog as a cheap cover up? (I'd much prefer the prior, if it is possible)

Last edited by deianthropus; 04/16/10 21:21.
Re: skyspheres, z-buffer and clipping [Re: deianthropus] #320397
04/21/10 15:21
04/21/10 15:21
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
Using a dome solves half of my problem (it renders behind game geometry), but I'd really like a sphere so that it may be possible to include levels with no horizon (eg space levels) -- which is best done with a spherical sky.

Can I mimic the process that renders the sky dome behind game geometry, using a sphere?

Re: skyspheres, z-buffer and clipping [Re: deianthropus] #320399
04/21/10 15:33
04/21/10 15:33
Joined: Apr 2010
Posts: 172
W
wdlmaster Offline
Member
wdlmaster  Offline
Member
W

Joined: Apr 2010
Posts: 172
The sky entities never worked properly. They always overlap geometry. I would use a 2nd view, behind the actual camera, and syncronize both views (pan/tilt/roll). The advantage: you can place any entity in this "background layer", and they are ALWAYS in the background. You only have to place the 2nd view (+ the background entities) somewhere, where the normal camera can't look at (a few thousand quants above/below the actual level).

Re: skyspheres, z-buffer and clipping [Re: wdlmaster] #320456
04/21/10 20:16
04/21/10 20:16
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
Thanks, this seems like a brilliant idea, but I must not be executing it right. I still get geometry overlap.

ENTITY* sky0;

VIEW* sky_view = {
layer = -9000;
flags = VISIBLE;
x = 0;
y= 0;
z= -20000;
}

function update_sky()
{
sky0.x = sky_view.x;
sky0.y = sky_view.y;
sky0.z = sky_view.z;
sky_view.pan = camera.pan;
sky_view.tilt = camera.tilt;
sky_view.roll = camera.roll;
}
function init_sky()
{
sky0 = ent_create("skygrad2.mdl",vector(sky_view.x,sky_view.y,sky_view.z),set(my,PASSABLE));
}


.... init_sky runs 1 time, update_sky is on a constant check. I feel I must still be missing something critical. Do I need to activate the view?



Last edited by deianthropus; 04/21/10 21:00.
Re: skyspheres, z-buffer and clipping [Re: deianthropus] #320466
04/21/10 20:41
04/21/10 20:41
Joined: Apr 2010
Posts: 172
W
wdlmaster Offline
Member
wdlmaster  Offline
Member
W

Joined: Apr 2010
Posts: 172
of course. both views need to be visible. and the NOSKY flag must be set for the camera.

If the background objects are static, you don't need to sync the camera position. Only the rotation.

Re: skyspheres, z-buffer and clipping [Re: wdlmaster] #320473
04/21/10 21:04
04/21/10 21:04
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
I think I got it. I needed to change sky_color to (0,0,0), and I used a set(sky_view,VISIBLE) rather than the existing flags = VISIBLE. Thanks for the input!

Re: skyspheres, z-buffer and clipping [Re: deianthropus] #320791
04/24/10 17:37
04/24/10 17:37
Joined: Apr 2010
Posts: 38
D
deianthropus Offline OP
Newbie
deianthropus  Offline OP
Newbie
D

Joined: Apr 2010
Posts: 38
Update: This works beautifully, especially if I put a "distant" terrain model in a layer between the camera and the sky (great illusion of scale for big, big mountains).

However (totally new issue, but i'll keep it in this thread because I'm dealing with the same outcome, if a bit expanded), I want to be able to set the file references per level, so that one level may have a different sky/distant terrain/etc from another. I suppose I could set it in the level script, but that hasn't worked for me (can a level script execute a main() function? if not, how do I work around this?)

Alternatively, I could use an external text file. This way, i could have all of my level variables set, as well as read an array of .hmp files for a LOD terrain system (load terrain in the camera view, with array entries corresponding to a 'geographic' location in order to load terrain and objects dynamically based on the location of the camera. [LOD similar to, say, Oblivion]). Thoughts? Experiences? Which is more practical?


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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