mi_blinn_specular built in function 2004-06-19 - By Nick
Back I'm trying to get the built in function mi_blinn_specular to work but I'm having some troubles with it. I want to retrieve the specular strength and although I've managed to do it with the built in mi_phong_specular somehow this one is escaping me... from shader.h: /* evalution of reflection models */ miScalar mi_blinn_specular( miVector *di, /* incident direction */ miVector *dr, /* direction of reflection */ miVector *n, /* surface normal */ miScalar roughness, /* average microfacet slope */ miScalar ior); /* index of refraction */
I've declared my variables: miColor spec = *mi_eval_color(&in_pParams->m_spec); miScalar roughness = *mi_eval_scalar(&in_pParams->m_roughness); miScalar ior = *mi_eval_scalar(&in_pParams->m_ior); miScalar spec_strength; miVector di; miVector dr; miVector n; miVector dir;
and am implementing it (while sampling the light shader) by using: spec_strength = mi_blinn_specular(&di, &dr, &n, roughness, ior);
I've tried replacing it with spec_strength = mi_blinn_specular(&state->dir, &dr, &state->normal, roughness, ior); which I got from looking at the baseblinn.c file included in the base shaders zip file from the MR ftp site. It's returning something, I'm now getting a result in the renderregion however it's not what I was expecting...
Cheers, Nick.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <META content="MSHTML 6.00.2800.1400" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>I'm trying to get the built in function </FONT><FONT face=Arial size=2>mi_blinn_specular to work but I'm having some troubles with it. I want to retrieve the specular strength and although I've managed to do it with the built in mi_phong_specular somehow this one is escaping me...</FONT></DIV> <DIV><FONT face=Arial size=2>from shader.h:</FONT></DIV> <DIV><FONT face=Arial size=2><FONT color=#008000>/* evalution of reflection models */</FONT><BR>miScalar mi_blinn_specular(<BR> miVector *di, <FONT color=#008000>/* incident direction */</FONT><BR> miVector *dr, <FONT color=#008000>/* direction of reflection */</FONT><BR> miVector *n, <FONT color=#008000>/* surface normal */</FONT><BR> miScalar roughness, <FONT color=#008000>/* average microfacet slope */<BR></FONT> miScalar ior); <FONT color=#008000>/* index of refraction */</FONT></FONT></DIV> <DIV><FONT face=Arial color=#008000 size=2></FONT> </DIV> <DIV><FONT face=Arial color=#008000 size=2><FONT color=#000000>I've declared</FONT> <FONT color=#000000>my variables:</FONT></FONT></DIV> <DIV><FONT face=Arial size=2>miColor spec = *mi_eval_color(&in_pParams->m_spec);<BR>miScalar roughness = *mi_eval_scalar(&in_pParams->m_roughness);<BR>miScalar ior = *mi_eval_scalar(&in_pParams->m_ior); <BR> miScalar spec_strength; </FONT></DIV> <DIV><FONT face=Arial size=2>miVector di;<BR>miVector dr;<BR>miVector n;<BR>miVector dir;</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>and am implementing it (while sampling the light shader) by using:</FONT></DIV> <DIV><FONT face=Arial size=2>spec_strength = mi_blinn_specular(&di, &dr , &n, roughness, ior);</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I've tried replacing it with</FONT></DIV> <DIV><FONT face=Arial size=2>spec_strength = mi_blinn_specular(&state->dir, &dr, &state->normal, roughness , ior);</FONT></DIV> <DIV><FONT face=Arial size=2>which I got from looking at the baseblinn.c file included in the base shaders zip file from the MR ftp site. It's returning something, I'm now getting a result in the renderregion however it's not what I was expecting... </FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Cheers,</FONT></DIV> <DIV><FONT face=Arial size=2>Nick.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV> </DIV></BODY></HTML>
|
|