Skip to content

Commit 6392bc6

Browse files
committed
Edited render-mx-anisotropic
1 parent 736b457 commit 6392bc6

3 files changed

Lines changed: 31 additions & 25 deletions

File tree

testsuite/render-mx-anisotropic-vdf/emitter.osl

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@
55

66
surface
77
emitter
8-
[[ string description = "Lambertian emitter material" ]]
8+
[[ string description = "Spot emitter material" ]]
99
(
1010
float power = 1
11-
[[ string description = "Total power of the light",
12-
float UImin = 0 ]],
11+
[[ string description = "Total power of the light",
12+
float UImin = 0 ]],
1313
color Cs = 1
14-
[[ string description = "Base color",
15-
float UImin = 0, float UImax = 1 ]]
16-
)
14+
[[ string description = "Base color",
15+
float UImin = 0, float UImax = 1 ]],
16+
float spread = 90
17+
[[ string description = "Spread angle in degrees",
18+
float UImin = 1, float UImax = 180 ]]
19+
)
1720
{
18-
// Because emission() expects a weight in radiance, we must convert by dividing
19-
// the power (in Watts) by the surface area and the factor of PI implied by
20-
// uniform emission over the hemisphere. N.B.: The total power is BEFORE Cs
21-
// filters the color!
22-
Ci = (power / (M_PI * surfacearea())) * Cs * emission();
23-
}
21+
vector wo = normalize(I);
22+
23+
float cosAngle = dot(N, -wo);
24+
25+
float halfSpread = radians(spread * 0.5);
26+
float cosThreshold = cos(halfSpread);
27+
28+
float falloff = (cosAngle > cosThreshold) ? 1 : 0;
29+
30+
Ci = (power / (M_PI * surfacearea())) * Cs * falloff * emission();
31+
}
247 Bytes
Binary file not shown.

testsuite/render-mx-anisotropic-vdf/scene.xml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,24 @@
1313
<Quad corner="0,100,0" edge_x="100,0,0" edge_y="0,0,150" /> <!-- Top -->
1414

1515
<ShaderGroup>color Cs 0.35 0.35 0.35; shader matte layer1;</ShaderGroup>
16-
<Sphere center="73,16.5,78" radius="16.5" /> <!-- Grey -->
16+
<Sphere center="50,50,70" radius="25" /> <!-- Grey -->
1717

18-
<ShaderGroup>float eta 15; shader metal layer1;</ShaderGroup>
19-
<Sphere center="27,16.5,47" radius="16.5" /> <!-- Mirror -->
2018

21-
<ShaderGroup is_light="yes">float power 26000; shader emitter layer1</ShaderGroup>
19+
<ShaderGroup is_light="yes">float power 90000; shader emitter layer1</ShaderGroup>
2220
<Quad corner="40, 99.99, 40" edge_x="20, 0, 0" edge_y="0, 0, 20" /> <!--Lite -->
2321

2422
<ShaderGroup>
25-
param color albedo 0.75 0.75 0.75;
26-
param float extinction 0.001;
27-
param float anisotropy 0.9;
23+
param color albedo 0.85 0.85 0.85;
24+
param float extinction 0.01;
25+
param float anisotropy 0.25;
2826

2927
shader anisotropic layer1;
3028
</ShaderGroup>
31-
<Quad corner="0,0,0" edge_x="99.9,0,0" edge_y="0,99.9,0" /> <!-- Bottom -->
32-
<Quad corner="0,0,0" edge_x="99.9,0,0" edge_y="0,0,149.9" /> <!-- Back -->
33-
<Quad corner="0,0,0" edge_x="0,99.9,0" edge_y="0,0,149.9" /> <!-- Left -->
34-
<Quad corner="99.9,0,0" edge_x="0,99.9,0" edge_y="0,0,149.9" /> <!-- Right -->
35-
<Quad corner="0,99.9,0" edge_x="99.9,0,0" edge_y="0,0,149.9" /> <!-- Front -->
36-
<Quad corner="0,0,149.9" edge_x="99.9,0,0" edge_y="0,99.9,0" /> <!-- Top -->
29+
<Quad corner="0,0,0" edge_x="99.99,0,0" edge_y="0,99.99,0" /> <!-- Bottom -->
30+
<Quad corner="0,0,0" edge_x="99.99,0,0" edge_y="0,0,149.9" /> <!-- Back -->
31+
<Quad corner="0,0,0" edge_x="0,99.99,0" edge_y="0,0,149.9" /> <!-- Left -->
32+
<Quad corner="99.99,0,0" edge_x="0,99.99,0" edge_y="0,0,149.9" /> <!-- Right -->
33+
<Quad corner="0,99.99,0" edge_x="99.99,0,0" edge_y="0,0,149.9" /> <!-- Front -->
34+
<Quad corner="0,0,149.9" edge_x="99.99,0,0" edge_y="0,99.99,0" /> <!-- Top -->
3735

3836
</World>

0 commit comments

Comments
 (0)