Page 1 of 1

Simple sphere

Posted: 2012-06-19, 20:20
by afgho
Hello,

i implemented a sky shader in Cafu however it need to be applied onto a sphere, i tried to make one using CaWe sphere brush but got the error "Stopped by leak", tried bezier patch and it work but the sky look bad (due to the shape), i thought i could use a model but it seem a bit overkill... is there something i could use to build it from scratch using the engine methods? looked at the documentation but a bit overwhelmed by it atm

Also, when i tested the shader with a bezier patch i could not delete the skybox due to the leak error, even if the world was inside the sphere, is there any way to get rid of the skybox and replace it by something else?

Re: Simple sphere

Posted: 2012-06-19, 20:27
by HWGuy
Most games don't use a sphere or dome for the skybox, instead it's a box that has a spherical projection on it. You can speed up the shader by having a vector map instead of texture data and have an almost purely shader sky.
Some games use a dome mesh tied to player position, not many.

Re: Simple sphere

Posted: 2012-06-20, 00:50
by afgho
I might just modify the shader then, seem not too complex to do.

The shader is based on this paper which assume a sky dome:
http://http.developer.nvidia.com/GPUGem ... ter16.html

EDIT: Err, actually harder than i thought. :roll:

Re: Simple sphere

Posted: 2012-06-20, 23:11
by Carsten
Well, the nice feature about cube-mapping is that we can have sky surfaces in a map everywhere, without being required to put huge cubes around the map or the player; it's all in the shaders, no actual geometry involved.

I've only glanced at the paper, but I wonder if something like that cannot be implemented in the pixel shader, combining the idea of cube mapping with the algorithm described there, getting rid of the spherical geometry... (and don't be surprised if many of the items presented in the GPU Gems only work in very specific settings... only very few of them are actually useful in general cases).