How all puts up an ambient light?

This topic is 5090 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

My aim is by imbue with light in the world , yet possess a term , that quite right can not by means of puts up in the substance material character the ambient light colour achieves . Is my opinion putting up an light through the view up the substance from start to finish , yet I do not have no idea of how changing the light place ( in the wake of viewpoint Matrix alternation ) ? Any good meanss does all possess ?

Share on other sites
Please rephrase your question - I didn't understand anything.

Share on other sites
I'm sorry for my poor english:)

I want to set a light in my scene(D3D),So I can see what my viewpoint face to,but my viewpoint is keep changing,so the light's position can't be fixed(Unchangeably).
What I want know is how i set the light's position(The viewpoint's matrix is M).

After all,is'there any other ways to keep world bright except setting the geometry's material(Ambient Color)?

Best wishes for New Year!

Share on other sites
IIRC the matrix M's most right top 3 values are the negatives of the worldmatrix.

[.] [.] [.] [-x]
[.] [.] [.] [-y]
[.] [.] [.] [-z]
[.] [.] [.] [..]

Share on other sites
Simple. Say your D3DLIGHT9 is light. Every frame, copy the camera's position into light.Position, and then call IDirect3DDevice9::SetLight to update it.

Quote:
 IIRC the matrix M's most right top 3 values are the negatives of the worldmatrix.[.] [.] [.] [-x][.] [.] [.] [-y][.] [.] [.] [-z][.] [.] [.] [..]

From the docs of D3DXMatrixLookAtLH:

xaxis.x           yaxis.x           zaxis.x          0xaxis.y           yaxis.y           zaxis.y          0xaxis.z           yaxis.z           zaxis.z          0-dot(xaxis, eye)  -dot(yaxis, eye)  -dot(zaxis, eye)  1

Share on other sites
Okay, whatever, I tried.

 Wait a second, that's the view matrix right? Then you probably need the world matrix' 3-values.

Share on other sites
Quote:
 Original post by Pipo DeClown Wait a second, that's the view matrix right? Then you probably need the world matrix' 3-values.

Yes, it's the view matrix - it is what holds the camera position and orientation. The world matrix transforms the model from local/model space to world-space, irrelevant of the camera.

Share on other sites
K, I think I need to go suicide. Thanks Coder!
*jumps off Ground Zero*

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• Forum Statistics

• Total Topics
633686
• Total Posts
3013324
×