Skip to content

Pass camera position to shader - #228

Closed
andreasterrius wants to merge 1 commit into
bevyengine:masterfrom
andreasterrius:shader-camera-position
Closed

Pass camera position to shader#228
andreasterrius wants to merge 1 commit into
bevyengine:masterfrom
andreasterrius:shader-camera-position

Conversation

@andreasterrius

Copy link
Copy Markdown

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
Copy Markdown
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

andreasterrius commented Aug 19, 2020

Copy link
Copy Markdown
Author

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
Copy Markdown
Contributor

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

@cart

cart commented Aug 20, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
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