-
1 Attachment(s)
Why does my cube look like this??
This is the light struct:
m_Light.Diffuse.r = 1.0f;
m_Light.Diffuse.g = 1.0f;
m_Light.Diffuse.b = 1.0f;
m_Light.Diffuse.a = 1.0f;
m_Light.Type = D3DLIGHT_POINT;
m_Light.Position = D3DXVECTOR3( 0.0f, 0.0f, 5.0f );
m_Light.Attenuation0 = 0.0f;
m_Light.Attenuation1 = 0.05f;
m_Light.Attenuation2 = 0.0f;
m_Light.Range = 10.0f;
cGraphicLayer::Graphics()->SetLight( 0, &m_Light );
This is how it looks with a simple 24 vertice cube positions at (0, -2, 10)
-
Re: Why does my cube look like this??
What are the normals of that cube?
-
Re: Why does my cube look like this??
Position, Normal, TexU, TexV, Diffuse
VERTEX_SINGLE g_cubeVertices[] =
{
{-1.0f, 1.0f,-1.0f , D3DXVECTOR3(0,0,-1), 0, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f, 1.0f,-1.0f , D3DXVECTOR3(0,0,-1), 1, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f,-1.0f,-1.0f , D3DXVECTOR3(0,0,-1), 0, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f,-1.0f,-1.0f , D3DXVECTOR3(0,0,-1), 1, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f, 1.0f, 1.0f , D3DXVECTOR3(0,0,1), 1, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f,-1.0f, 1.0f , D3DXVECTOR3(0,0,1), 1, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f, 1.0f, 1.0f , D3DXVECTOR3(0,0,1), 0, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f,-1.0f, 1.0f , D3DXVECTOR3(0,0,1), 0, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f, 1.0f, 1.0f , D3DXVECTOR3(0,1,0), 0, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f, 1.0f, 1.0f , D3DXVECTOR3(0,1,0), 1, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f, 1.0f,-1.0f , D3DXVECTOR3(0,1,0), 0, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f, 1.0f,-1.0f , D3DXVECTOR3(0,1,0), 1, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f,-1.0f, 1.0f , D3DXVECTOR3(0,-1,0), 0, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f,-1.0f,-1.0f , D3DXVECTOR3(0,-1,0), 1, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f,-1.0f, 1.0f , D3DXVECTOR3(0,-1,0), 0, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f,-1.0f,-1.0f , D3DXVECTOR3(0,-1,0), 1, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f, 1.0f,-1.0f , D3DXVECTOR3(1,0,0), 0, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f, 1.0f, 1.0f , D3DXVECTOR3(1,0,0), 1, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f,-1.0f,-1.0f , D3DXVECTOR3(1,0,0), 0, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{ 1.0f,-1.0f, 1.0f , D3DXVECTOR3(1,0,0), 1, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f, 1.0f,-1.0f , D3DXVECTOR3(-1,0,0), 1, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f,-1.0f,-1.0f , D3DXVECTOR3(-1,0,0), 1, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f, 1.0f, 1.0f , D3DXVECTOR3(-1,0,0), 0, 0, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)},
{-1.0f,-1.0f, 1.0f , D3DXVECTOR3(-1,0,0), 0, 1, D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f)}
};
-
Re: Why does my cube look like this??
It looks very nice... Could the normals also be set up so that the cube would seem round?
-
Re: Why does my cube look like this??
I kinda like it, its very abstract ;) Just leave it :mike:
-
Re: Why does my cube look like this??
The normals are wrong on some of the polygons, especially the top one. I see you posted this problem in www.gamedev.net . I answered you in there as well. :bigyello:
-
Re: Why does my cube look like this??
Well I will review it in gamedev shortly but the problem is probably not what you think it was.
It was all in the order I was defining my VERTEX structure
D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 | D3DFVF_DIFFUSE
Cause's massive errors within texturing and lighting.
D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX1
This works just fine.
-
Re: Why does my cube look like this??
Care to help with the normals jacob?
-
Re: Why does my cube look like this??
Quote:
Originally Posted by Halsafar
Well I will review it in gamedev shortly but the problem is probably not what you think it was.
It was all in the order I was defining my VERTEX structure
D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 | D3DFVF_DIFFUSE
Cause's massive errors within texturing and lighting.
D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX1
This works just fine.
That's very wierd that it works. The order of the OR operator parameters shouldn't make a difference...
-
Re: Why does my cube look like this??
Quote:
Originally Posted by Halsafar
Care to help with the normals jacob?
For the top polygon, try reversing the Y normal and see if it looks right.
-
Re: Why does my cube look like this??
Jacob I believe my normals are just fine since it all looks GREAT!
My D3D Lighting looks awesome!
Anyway, SLH, check out this article:
http://msdn.microsoft.com/archive/de...s/vformats.asp
It should explain that order is important in some case's.
When TextureCoords are involved they should always be last
Colors such a diffuse and specular should come after any normal.
The normal should be after position
Position should always be first
-
1 Attachment(s)
Re: Why does my cube look like this??
Does this not look right Jacob????
The cube has been rotated around the z and y 45 degree
-
1 Attachment(s)
Re: Why does my cube look like this??
Infact, if anyone wants, here is an exe which will show the joy:
Esc - Quit
F1 - Switch from fullscreen to windowed
1,2,3 - Raise Attentuation 1,2,3
4,5,6 - Lower Attentuation 1,2,3
Arrow keys - Move light up, down, left, right
Comma - Move light Z-
Period - Move Light Z+
This is a multithreaded application, the gameloop is in one thread and the msg pump is in another.
It has reset functionality so you can alt+tab from fullscreen without a problem.
Post any remarks if you want
-
Re: Why does my cube look like this??
Quote:
Originally Posted by Halsafar
Does this not look right Jacob????
The cube has been rotated around the z and y 45 degree
Looks like a rock cube to me :bigyello:
Wheres the lighting?
-
Re: Why does my cube look like this??
The only reason you can see it is cause of the lighting
But you can notice it trail off on the top properly in the back.
The light is position in front of the cube and above the cube, about 2 units away.
As for the rock, I just wanted something which was made of well varied varations of a few colors that remains noticeable under any light. To see how the lighting effects can look.
Run the exe I posted. There is no way it is harmful, I love this site, I do not want to get banned.
-
Re: Why does my cube look like this??
I get an error when trying to run it...
d3dx9_24.dll was not found
and windows won't let me reinstall directx 9.0c... strange
-
Re: Why does my cube look like this??
Hmmmm.
Well if thats not your comps problem then I have no idea why.
I'm goona go test this on another comp right now.
-
Re: Why does my cube look like this??
OKAY
It seems MS has done it again.
The new d3dx9.lib links to a DLL instead of static linking!
http://www.gamedev.net/community/for...opic_id=311888
Check out that extensive article.
While I believe I am bound to the EULA agreement, so I cannot distro the correct DLL to you.
I believe I am compiling with the APRIL update.
But I did copy the program and the dll to another computer, if the dll is placed into the same directory as the exe it will work.
THIS IS WHY I SAY NEVER USE D3DX!!!!!!!!!!!!!
-
Re: Why does my cube look like this??
That really sucks :(
Why is MS being so unreasonable?
-
Re: Why does my cube look like this??
Good question. They are the same people that are killing off VB and slowly trying to make VB.NET look like C#. Not to mention making all the latest programming languages require the .NET framework. Bastards :mad:
-
Re: Why does my cube look like this??
VB was made my MS.
So was C#
VB sucks if you ask me, forget about it.
If you do not like the big distro problem, use c++, it never has a distro problem....well till now... But your VB apps should encounter the same prob.
-
Re: Why does my cube look like this??
Quote:
Why is MS being so unreasonable?
Someone actually asked it. Finally.
Yet you still blindly follow...
.NET is not a bad idea. Especially when open-source minds come up with something as utterly delightful as mono. But, anyway.
VB on the other hand, IS a bad idea. But that's not the point either.
Anything that depends on arbitrary changes to get working is not production-ready, or ready in any sense at all. Get a refund and read up on something that won't be disowned in a couple of years: http://www.opengl.org/
-
Re: Why does my cube look like this??
You think DX is going to be stopped??
-
Re: Why does my cube look like this??
No, I think the version that you're using will, forcing you to rewrite to take advantage of new features.
-
Re: Why does my cube look like this??
Hopefully DirectX X (as in roman numeral 10) that'll be in the new Windows Longhorn thats coming out, would be better.