Jump to content

[SOLVED] -Get Value From Shader Effect


MackeyK24
 Share

Recommended Posts

We use material.effect.setFloat and setTexture so on an so forth... Is there a way to GET a rule from a shader... Unless i am just stupid and don't see it, again :)

How do or can we event getFloat on a value that we can calculate in the shader... or even some present GLSL output property we can read ???

Link to comment
Share on other sites

There is not, only the color output at the fragment shader.
However there is a trick: you can use pixel color values to encode float output.
You can access the pixel output with engine.readPixels after the rendering.
This is how the HDR shader works by calculating luminance:
https://github.com/BabylonJS/Babylon.js/blob/master/src/PostProcess/babylon.hdrRenderingPipeline.ts#L373

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...