Hi There!
Been porting my shader for Opengl for compatibility reasons. But it seems I cant sample any texture in custom code. Not even Autodesk example works, even though it works in the shaderfx swatch.
It works with OpenGL legacy, seems to be a problem with OGSFX
Did anyone have this kind of problem before or know whats up? Maybe
@shaderfx or
@kodde?
Thanks!!
Replies
For some reason this is missing from docs. Docs include code for GLSL_4 that only works in swatches.
The code for GLSL_4 uses the texture node:
float3 t = texture( SFX_TEXTURE0, float2(UV.x, 1-UV.y) ).xyz;
While OGSFX uses the sampler node.
float3 t = texture( SFX_SAMPLER0, float2(UV.x, 1-UV.y) ).xyz;
Problem solved.
I was going to say I haven't dabbled with sampling textures with custom code.
Good to hear you solved it.
I mainly use it to get dimensions so I dont need a toggle to enable texture maps.
But there is a problem, swatches dont use OGSFX, so you lose the ability to check for compile errors, because every OGSFX code turns out as an error in the compiler (even though they work in the viewport).
The solution is to use compile time if else to add both codes, swatches and viewport. more than doubling the code in many cases =(
Maybe that is helpful?
(ShaderFX tells you what that env variable is when you first open the UI)
But if you want to support all the different viewport modes that Maya has, then you have little choice but to add code for each different mode unfortunately.
Since you are here, haha, let me seize the oportunity! Is there any hope that we get area light corners? Maya viewport has access to it, and preview it correctly, its exposed in the API. And maybe one day access to the framebuffer? It would be awesome to prototype full screen effects in shaderfx!
A script to automatically connect substance painter textures to an arnold shader, then create a shaderfx preview materials with attributes linked to the arnold shader, so when you change one the other changes too, aiming to get as close as possible to the arnold render.
Left is the viewport right is arnold render.