Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass camera position to shader #228

Closed
wants to merge 1 commit into from
Closed

Pass camera position to shader #228

wants to merge 1 commit into from

Conversation

andreasterrius
Copy link

Pass camera position to shader to calculate fragment to camera direction.
Will be useful for specular/fresnel calculation later on

@karroffel karroffel added the A-Rendering Drawing game state to the screen label Aug 18, 2020
@lachlansneff
Copy link
Contributor

Can we pass more to the camera here? A particular usecase of mine requires the world matrix, the projection matrix, and an inverted view matrix.

@andreasterrius
Copy link
Author

andreasterrius commented Aug 19, 2020

I could try, I'll look into it after I get off work today.

What's a world matrix btw ? I am not too familiar with the terminologies

I am also curious about the use case, is it for shading purposes ?

@lachlansneff
Copy link
Contributor

Actually, I spoke too soon, those aren't appropriate to pass here.

@cart
Copy link
Member

cart commented Aug 20, 2020

The "world matrix" would probably be useful in some cases and the world position can be extracted from it. That might be the more "general purpose" solution. We could also consider making this an "optional" binding that is separate from the ViewProj. I honestly don't know the best choice here. Maybe we should look at what other engines do for this.

@andreasterrius
Copy link
Author

I'm closing this PR, I think this is better if this is done alongside shader implementations (such as #261 ), since we would know better what to pass to the shaders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants