goldleaf Posted April 12, 2012 Share Posted April 12, 2012 (edited) I've been trying my hand at writing VEX shaders by hand, and I can't get emission to work in my shader. I've read in a couple of threads here on odForce to put a value in Ce, but I'm getting an undefined variable error, saying Ce doesn't exist. Is it not a global variable, like F or Cf? #pragma opname test_1 #pragma oplabel "crydalch bsdf tests" #pragma opmininputs 0 #pragma opmaxinputs 0 #pragma label diff "Diffuse Color" #pragma hint diff color #pragma label diff2 "Other Diffuse" #pragma hint diff2 color #include <voptype.h> #include <voplib.h> #include <voptype.h> #include <voplib.h> surface test_1( vector diff = { 1, 1, 1 }, diff2 = { 1, 0, 0 }; float bi = 0.5, rgh = 1, atte = 1; int tur = 1) { bsdf f; bsdf f1; bsdf tmp; bsdf illum; float noiseAmnt; vector transformedP; // You need to transform P into object space, to pick up transformations transformedP = ptransform("space:object", P); noiseAmnt = snoise(transformedP,tur,rgh,atte); f = 1 * lerp(diff,diff2,noiseAmnt) * bsdf(diffuse(N)); //f = 0.5 * diff * bsdf(diffuse(N)); f1 = 0.05 * bsdf(specular(N)); illum = emission_bsdf(f * 2); tmp = f + f1; Cf = diff; Ce = illum; F = tmp; } Obviously, I'm not understanding how emission works in the shader, so any advice would be greatly appreciated. Thank you! Thanks! Edited April 12, 2012 by goldleaf Quote Link to comment Share on other sites More sharing options...
symek Posted April 12, 2012 Share Posted April 12, 2012 test_1( vector diff = { 1, 1, 1 }, diff2 = { 1, 0, 0 }; float bi = 0.5, rgh = 1, atte = 1; int tur = 1; export vector Ce={0,0,0}) (...) Hey goldleaf, you just need to declare it as an export variable. Cheers! skk. Quote Link to comment Share on other sites More sharing options...
goldleaf Posted April 12, 2012 Author Share Posted April 12, 2012 (edited) Sweet! Thank you so much! Here's an image (sorry the compression killed the glow spill, but it's there!) Emission levels, left to right: 0, 1, 10, 10 (no AreaLight) Edited April 12, 2012 by goldleaf Quote 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.