SpiderPig Posted January 24, 2023 Share Posted January 24, 2023 I'm writing my own shader and am wondering if I can use an integer to identify the texture slot in a material? "slot":0 Quote Link to comment Share on other sites More sharing options...
Josh Posted January 24, 2023 Share Posted January 24, 2023 I don't think the JSON material format is very well nailed down right now. I have been sloppy with this. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted January 24, 2023 Author Share Posted January 24, 2023 Ah okay. I am curious though how to pass multiple textures to the shader for terrain... is there like a 2D texture array slot or something or we just set it just like Leadwerks; Obviously I can manipulate the shader to read from the appropriate slots. slot0 : DIFFUSE1 slot1 : NORMAL1 slot2 : DIFFUSE2 slot3 : NORMAL2 slot4 : DIFFUSE3 slot4 : NORMAL3 etc... Quote Link to comment Share on other sites More sharing options...
reepblue Posted January 24, 2023 Share Posted January 24, 2023 Yeah, there was documentation on the material format but it was years ago. I recall there being features like texture scrolling and such in the default shaders too but I'm not sure if they still are implemented. Hopefully this gets cleaned up and documented in the near future. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Solution Josh Posted January 26, 2023 Solution Share Posted January 26, 2023 Let's keep it simple. Here is a valid material file: { "material": { "color": [1.0, 1.0, 1.0, 1.0], "displacement": 0.1, "emission": [0.0, 0.0, 0.0], "metallic": 0.0, "roughness": 1.0, "shaderFamily": "Shaders/PBR.json", "shadow": true, "tessellation": false, "texture0": "./defaultmeshface.tex", "transparent": false } } For textures, a file in the same folder as the material file can use a relative path by adding ./ at the beginning of the path. Otherwise it will be considered a path relative to the project folder, i.e. "Materials/brick/brick01.dds". 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted January 26, 2023 Author Share Posted January 26, 2023 Simple is best. Is MAX_TEXTURES_2D the limit for an individual material? I think assigning textures in code can't go over 16. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 26, 2023 Share Posted January 26, 2023 16 is the limit. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
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.