Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
mi_blinn_specular built in function

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>&nbsp;&nbsp;miVector&nbsp;*di,&nbsp;&nbsp;<FONT
color=#008000>/* incident direction
*/</FONT><BR>&nbsp;&nbsp;miVector&nbsp;*dr,&nbsp;&nbsp;<FONT color=#008000>/*
direction of reflection
*/</FONT><BR>&nbsp;&nbsp;miVector&nbsp;*n,&nbsp;&nbsp;<FONT color=#008000>/*
surface normal */</FONT><BR>&nbsp;&nbsp;miScalar&nbsp;roughness,&nbsp;<FONT
color=#008000>/* average microfacet slope
*/<BR></FONT>&nbsp;&nbsp;miScalar&nbsp;ior);&nbsp;&nbsp;<FONT color=#008000>/*
index of refraction */</FONT></FONT></DIV>
<DIV><FONT face=Arial color=#008000 size=2></FONT>&nbsp;</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(&amp;in_pParams-&gt;m_spec);<BR>miScalar roughness =
*mi_eval_scalar(&amp;in_pParams-&gt;m_roughness);<BR>miScalar ior =
*mi_eval_scalar(&amp;in_pParams-&gt;m_ior);&nbsp;<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>&nbsp;</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(&amp;di, &amp;dr
,
&amp;n, roughness, ior);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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(&amp;state-&gt;dir, &amp;dr, &amp;state-&gt;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&nbsp;ftp site. It's returning
something, I'm now getting a result in the renderregion however it's
not&nbsp;what I was expecting... </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>