Jump to content
  • Advertisement
Sign in to follow this  
tgtt

How all puts up an ambient light?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


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


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

Share this post


Link to post
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 0
xaxis.y yaxis.y zaxis.y 0
xaxis.z yaxis.z zaxis.z 0
-dot(xaxis, eye) -dot(yaxis, eye) -dot(zaxis, eye) 1

Share this post


Link to post
Share on other sites
Quote:
Original post by Pipo DeClown
[edit] 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 this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!