newbie help with Skybox shading?

All about the core api and animation, input, sound, effect, collision and physics engines.
You can also post here your feature requests.

Moderator: Brume Dev Team

newbie help with Skybox shading?

Postby jeskeca on Wed Apr 02, 2008 7:00 pm

First off, while I'm a seasoned programmer, I'm a total 3d newbie.

I found brume + visual studio express a really easy way to get some polys up on the screen. The availability of the ultra simple demos really helped me poke around and imitate pieces to get what I want.

However, I'm having some trouble with putting in a skybox. Brume has provisions for a skydome, however I have a more traditional skybox cube-face set of textures. I made a cube and imitated the skydome to get the culling switched and the cube sized. I threw a texture on it, and tossed Lighted=false in there, and I can see the skybox. However, I'm stuck on my next goals...

(a) how do I texture different faces of the cube with textures loaded from different files?

(a) how do I setup lighting to avoid the edges of my cube being visible?

This is for a space game, so I need all directions rendered and none of the daylight shading being done on the skydome.

My setup looks like this right now:
Code: Select all
BrumeCubeMeshTextured skyMesh = new BrumeCubeMeshTextured(this, "SkyBox Cube");
BrumeInfiniteObject skyBox = new BrumeInfiniteObject(this, "SkyBox", skyMesh);
BrumeTexture texture1 = this.GetTexture("spaceboxzg5_bk.png");  // only the first of 6 faces
skyBox.RenderStates.Texture[0] = texture1;
skyBox.RenderStates.Culling = BrumeRenderParams.CULLING_CLOCK;
skyBox.RenderStates.Perspective = BrumeRenderParams.PERSPECTIVE_INFINITE;
skyBox.RenderStates.ZBuffered = true;
skyBox.RenderStates.ZWriting = true;
skyBox.RenderStates.Lighted = false; // just so I can see it

- David
jeskeca
Brume Rookie
 
Posts: 17
Joined: Wed Apr 02, 2008 4:52 pm

Re: newbie help with Skybox shading?

Postby Silmaryls on Thu Apr 03, 2008 7:50 pm

Hi David,

The BrumeCubeMeshTextured object is mapped with the same texture on all faces. Designing a BrumeMesh by code will be pretty complicated but you can just use the Data\Internal\brume_addons\brume_sky\brume_sky.x mesh that is present in Brume demo.
This mesh is mapped with 6 diffrent image files and all you have to do is to replace Brume's image files with yours.
This way you should have a better result.

If you want to see a concrete sample, take a look at IceCube : it's using this mesh for the sky (with pretty bad images :? you can obtain better results for space)

Here is the source code used to load and setup the mesh :
Code: Select all
            // Sky (must be first)
            BrumeXMesh cubeMesh = new BrumeXMesh(this, "ice", "ice.x", false);
            BrumeInfiniteObject sky = new BrumeInfiniteObject(this, "Sky", cubeMesh);
            sky.RenderStates.Lighted = false;


You can notice that the mesh name is not the same but in fact it was just renamed (it's a text file so you can also rename image names)
You can also avoid the use of BrumeInfiniteObject and use a BrumeObject instead if you don't like infinite projection mode.
For sky shading, disabling light is the good solution too.


Silmaryls
User avatar
Silmaryls
Brume Team Member
 
Posts: 340
Joined: Tue Feb 21, 2006 10:09 pm
Location: Paris - France

Re: newbie help with Skybox shading?

Postby jeskeca on Fri Apr 04, 2008 1:08 am

Silmaryls wrote:The BrumeCubeMeshTextured object is mapped with the same texture on all faces. Designing a BrumeMesh by code will be pretty complicated but you can just use the Data\Internal\brume_addons\brume_sky\brume_sky.x mesh that is present in Brume demo.
This mesh is mapped with 6 diffrent image files and all you have to do is to replace Brume's image files with yours.
This way you should have a better result.


I don't see a \Data\Internal\brume_addons directory (only brume_core) in any of the downloads I can get from your site. However, I did find the Skymap directory with ice.x in the IceCube demo, and was able to change it to use my space texture instead, thanks.

Silmaryls wrote:Well a six sided dds sounds like a cubemap...


Yes, i have dds cubemaps -- partly because there are many .dds cubemaps available around the Internet. I found a tool from ATI (cubemapgen) that was able to pull the dds files apart and output them as individual files. It was an interseting task to get them lined up correctly, and in the end the ice.x mesh bottom cube was rotated from typical, but that was pretty quick to fix. Now I have a gorgeous skybox!

Silmaryls wrote:Cubemaps are not supported out of the box. You can use a shader to access them but brume cannot map the cubemap on the cube directly.
In brume even skyboxes are 6 sided cubes with 6 different image files (all encoded in the mesh file).
There is a sample with cube mapping on a sphere in the Game.cs file that you can easily adapt to a cube.


I tried to start from the example in Game.cs first, but I can't find the referenced "environment.fx" or "sky_cubemap.dds" anywhere to get it to a working starting point. Are these files available somewhere?

-----

Now on to my next challenge, how to render a bunch of "skybox stars" as 3d points in Brume. I don't see a point primitive, but I do see a particle system. Time for some investigation.

One of the things that confuses me about Brume, is that I don't understand the scene graph. Is there a proper graph? I tried to attach a camera to a node using "addchild" and the camera didn't translate when I translated the node.
jeskeca
Brume Rookie
 
Posts: 17
Joined: Wed Apr 02, 2008 4:52 pm

Re: newbie help with Skybox shading?

Postby Silmaryls on Mon Apr 07, 2008 8:15 pm

jeskeca wrote:I tried to start from the example in Game.cs first, but I can't find the referenced "environment.fx" or "sky_cubemap.dds" anywhere to get it to a working starting point. Are these files available somewhere?


You can get the files in Brume Demo here : http://downloads.sourceforge.net/brume/ ... g_mirror=0

Silmaryls
User avatar
Silmaryls
Brume Team Member
 
Posts: 340
Joined: Tue Feb 21, 2006 10:09 pm
Location: Paris - France


Return to Technical discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron