Jump to content

Is there a way to include customized shaderIncludes into the generated js file when playing with materialsLibrary?


heyzxz
 Share

Recommended Posts

Hi there,

I'm creating some customized materials in the materials library followed this tutorial. For each material, my work flow is something like this:

1. Create a folder  in 'materialsLibrary/src/',  then put 1 'ts' and 2 'fx' files in that folder(babylon.xxxMaterial.ts,  xxx.vertex.fx,  xxx.fragment.fx). Which is exactly followed the tutorial.

2. Once I finish, I run '$ gulp materialsLibrary' to convert all of the 3 files into one js file, then I copy&paste this js file directly into my project.

My problem is: I use customized shaderIncludes in the shader codes. To make it work, I have to put these shaderIncludes in the place where the builtin includes are, but  when generating the output file,  these includes can't be added into the js file, so I have to also copy these includes manually into my project.

Not very sure if this is the correct way  to handle customized includes, is there a better way?

You may ask why I need customized includes, because I want to use UBO, so I followed the variable declaration logic which the builtin shaders did( three declaration files as includes: xxxVertexDeclaration.fx, xxxUboDeclaration.fx, xxxFragmentDeclaration.fx)

 

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...