Skip to main content
gamedev.net
🔒 Locked

Normals,Camera

Started by Zmax 3 replies 750+ views
Original Post
Zmax
Zmax
I created a custom shape...looks like a cylinder.My fiew range is very very big but i can't see only parts of my custom cylinder.I'f i'm close enough i can see it all.How should those normals be so i can see it all from distance too. Ex: if i move the camera rigth i see 10 vertexes of it...left 5...it depends on the position of the camera too.I tryed too with ligths of...the same thing.What could be?(I thought that those normals should point to the outer of the cylinder,..but seems not to be that)
Armadon
Armadon
Hi there ZMax,
How are you doing buddy?

The Problem
Custom Shape(Cylinder) is not visible

The Solution
Here are a few simple checks that might be helpfull ;)

1) What is your clipping planes set at?
e.g. D3DXMatrixPerspectiveFovLH(&mat, D3DX_PI/6, 4.0f/3.0f, 1.0f, 1000.0);
so 1.0f and 1000.0f are your clipping planes. If parts of your cylinder is
out of the clipping planes it won't be visible.

2) Are you sure you generated your normals correclty?
e.g. If the light hits your normals and they are incorrect it might seem
like your cylinder is clipped since parts won't be visible.
you could debug your normals by drawing lines from the origin of the normal
point outwards in the normal's direction.

3) What light did you create?
The light might be attenuating and not fall on the object meaning the object
might not be lit in some places.
You could debug it by specifying a directional light which does not
attenuate.


I hope this helps buddy.
Take care.
Zmax
Zmax
the first thing can't be im using something like that: D3DXMatrixPerspectiveFovLH(&mat, D3DX_PI/6, 4.0f/3.0f, 1.0f, 5000.0);,...i have something flat under that cilinder that is visible.
My ligth is directional i think it should work.Now the normals I've set them all to up(0,1,0) because the ligths comes form the sky (0,-1,0)...should they all point to the outer of the shape?(I tryed so too,..same thing,..whan i'm rotating the camera vertices dissapear)
Armadon
Armadon
Hi there ZMax,

The Problem
Incorrect normals.
The Solution
From what I gather from your last post you have incorrectly specified your normals.
If you have set all the normals to (0, 1, 0) they are incorrect.

Normals
Normals are vectors at right angles to the surface. In Direct3D your specify vertex normals.

How do I correct it?
Look at this example of a cube


You could also read more about normals at my tutorial on lights and materials.

I hope this helps buddy.
PS: Generally when working with models you wouldn't hardcode all the vertices yourself but rather have a modeller that creates a model in a modelling program like 3D studio max and then export the model in a usable mesh format.
Zmax
Zmax
Hmm...yes I wanted to create a random tree in my application...it will generate the tree from the bottom up to the last leaf.But i have problems with the branches...The normals were all set to outer of the shapes.
The branch looks like a cylinder but i've used only 8*2 vertices for a rigth branch.There are actuly 2 octagons made of vertexes facing each other.The shape looks ok normals seem to be all rigth...hmm.

This is what i'm talking about:
http://www.zamolxe.3x.ro/Images/i2.JPG
http://www.zamolxe.3x.ro/Images/i1.JPG

[Edited by - Zmax on September 18, 2005 6:54:31 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.