「利用者:Jehuty/GSoC 2013/Discussions/Texture Lookup」の版間の差分
< 利用者:Jehuty | GSoC 2013
(→Texture Lookup) |
細 (1版 をインポートしました) |
(相違点なし)
|
2018年6月29日 (金) 05:57時点における最新版
Texture Lookup
The script
For early texture lookup tests, the OSL script below has been used to call the texture3d callback method in OSLServices.
#include "stdosl.h"
#include "node_color.h"
color image_texture_lookup(string filename, string color_space,
float x, float y, float z, output float Alpha)
{
point P = point (x, y, z);
color rgb = color ("rgb", 0, 0, 0);
float result = 0;
result = (float)texture3d(filename, P, "wrap", "periodic", "alpha", Alpha);
if (result != 0)
rgb = rgb + result;
else
rgb = color ("rgb", 1, 1, 1);
return rgb;
}
shader volume_texture_shader(
point Vector = P,
string filename = "",
string color_space = "sRGB",
float projection_blend = 0.0,
output color Color = 0.0,
output float Alpha = 1.0)
{
point p = Vector;
Color = image_texture_lookup(filename, color_space, p[0], p[1], p[2], Alpha);
}