Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

View matrix not accessible in shader by default #5504

Copy link
Copy link
@Dawars

Description

@Dawars
Issue body actions

By default a few useful uniforms don't get set for a shader.
The defaults are: MVP (transform), MV, P, (MV)^-1T (normalMat) and textureMat.

In addition it would be useful to set the view, viewInv matrices and the cameraPos vector.
For example when working in world space (reflection/refraction with env mapping).

It is possible to set them manually:

pg = (PGraphicsOpenGL) this.g;
...
shader.set("view", pg.camera);
shader.set("viewInv", pg.cameraInv);
shader.set("cameraPos", pg.modelviewInv.m03, pg.modelviewInv.m13, pg.modelviewInv.m23);

And then the model matrix can be calculated in the shader like this: viewInv * modelview

I'm going to make the required changes during the next week.
My question is, how should I call them according to the conventions (alternative names)?

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.