Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have just started programming DirextX in C#. I have a question about the basics.

 

I have created a simplke cube mesh in Max 6 then exported the mesh with texture into a file named cube.x

 

Tutorial Here

 

Then I loaded the mesh into my app. I have rotated and zoomed around the object no problem. Also using standard mesh objects I have created other cubes etc. in myproject.

 

I have been having a blast.

 

World ... location for placing objects.

View ( or camera ) ... location of you viewing

projection ... Field of View, aspect of ratio, start view point on z axis, end view point z axis

 

One Question though is that after the end view point of the projection goes out of range, it cuts my mesh off into blue space .... anyone know anything about envoirnment mapping or volume fog?

 

:D

Posted

Fogging is supposed to be really simple to set up, you just configure:

FOGENABLE - Set to True to turn fog on

FOGTABLEMODE - Do you want table fog?

FOGVERTEXMODE - Fog method, usually Linear

RANGEFOGENABLE - Higher quality fog, hw dependent

FOGSTART - I'm not sure how these values work, you'll need to work it out

FOGEND -

FOGCOLOR - Specify the color of the fog

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

You need to set cull mode off

 

And you need to set the near and far clipping planes

 

Matrix.PerspectiveFOVLH(fov, aspect ratio, near plane, far plane)

 

The far plane determines when vertices are no longer vivsble.

My website
Posted

PORTAL MAPS

 

Turning off CULL MODE not nessasarily a good idea. CULL is also responsible for back face culling, or not drawing the stuff you don't see, and would slow down a gaming engine using alot of models, from what I have read.

 

I have set the near and far planes ( that's the projection mentioned in the first post ). The titled cube mesh I created is huge in unit size, without a large far plane it is only part visable.

 

I believe that PORTAL MAPS and FOG are the ones for me.

 

There are 2 types of FOG in Directx Vertex and Pixel. Vertex done by Directx in CPU space and Pixel by the Graphics Card. So I choose pixel.

 

So I have to set the render state for fog. Something like this ...

 

Device.SetRenderState(D3DRS_FOGENABLE, bTRUE);

Device.SetRenderState(D3DRS_FOGCOLOR, Color);

 

But there lies my problem ...

 

(85): 'Microsoft.DirectX.Direct3D.Device.SetRenderState(int, float)' is inaccessible due to its protection level

 

:-\

Posted

PIXEL FOG

 

:eek:

 

Using C# you can't call SetRenderState, you have to address the properties instead ... silly me. This code worked.

 

device.RenderState.FogEnable = true;

device.RenderState.FogTableMode = Direct3D.FogMode.Linear;

device.RenderState.FogStart = 60.0f;

device.RenderState.FogEnd = 150.0f;

device.RenderState.FogDensity = 0.0001f;

device.RenderState.FogColor = System.Drawing.Color.Blue;

Posted
Sometimes turning cullmode off for individual objects is necessary(If you're doing AlphaBlending on the cube, culling will still take off the back faces so it'll look strange when you can see through the cube) but generally it's always left on unless there is a reason not to.
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...