-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating the SkydomeTask to render the domeLight texture as a skydome. This additional task is added to the _renderTaskIds as the first task in the HdxTaskController so that the AOVs are properly cleared. Fixes #1385 (Internal change: 2182199)
- Loading branch information
Showing
18 changed files
with
550 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
-- glslfx version 0.1 | ||
|
||
// | ||
// Copyright 2021 Pixar | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "Apache License") | ||
// with the following modification; you may not use this file except in | ||
// compliance with the Apache License and the following modification to it: | ||
// Section 6. Trademarks. is deleted and replaced with: | ||
// | ||
// 6. Trademarks. This License does not grant permission to use the trade | ||
// names, trademarks, service marks, or product names of the Licensor | ||
// and its affiliates, except as required to comply with Section 4(c) of | ||
// the License and to reproduce the content of the NOTICE file. | ||
// | ||
// You may obtain a copy of the Apache License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the Apache License with the above modification is | ||
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the Apache License for the specific | ||
// language governing permissions and limitations under the Apache License. | ||
// | ||
|
||
-- configuration | ||
{ | ||
"techniques": { | ||
"default": { | ||
"SkydomeFragment": { | ||
"source": [ "Skydome.Fragment" ] | ||
} | ||
} | ||
} | ||
} | ||
|
||
-- glsl Skydome.Fragment | ||
|
||
const float PI = 3.1415926535898; | ||
const float farPlane = 1.0; | ||
|
||
float wrapSampleValue(float value) | ||
{ | ||
if (value < 0.0) { | ||
value += 1.0; | ||
} | ||
else if (value > 1.0) { | ||
value -= 1.0; | ||
} | ||
return value; | ||
} | ||
|
||
// from PreviewSurface.glslfx | ||
vec2 projectToLatLong(vec3 sample3D) | ||
{ | ||
// project spherical coord onto latitude-longitude map with | ||
// latitude: +y == pi/2 and longitude: +z == 0, +x == pi/2 | ||
float x = (atan(sample3D.z, sample3D.x) + 0.5 * PI) / (2.0 * PI); | ||
float y = acos(sample3D.y) / PI; | ||
|
||
return vec2(wrapSampleValue(x), wrapSampleValue(y)); | ||
} | ||
|
||
|
||
void main(void) | ||
{ | ||
// Transform the UV coordinates into NDC space and place at the far plane | ||
// (z = 1) before transforming into view space. | ||
vec2 uvOut_ndc = (uvOut * vec2(2.0)) - vec2(1.0); | ||
vec4 uvOut_view = invProjMatrix * vec4(uvOut_ndc, farPlane, 1.0); | ||
|
||
// Normalize to use as the initial sampleDirection | ||
vec3 sampleDirection = normalize(uvOut_view.xyz); | ||
|
||
// Apply the camera rotation and lightTransform to the sampleDirection | ||
sampleDirection = | ||
( lightTransform * viewToWorld * vec4(sampleDirection, 0.0) ).xyz; | ||
|
||
// Sample Skydome Texture with the sampleDirection | ||
vec2 sampleCoord = projectToLatLong(sampleDirection); | ||
hd_FragColor = vec4(HdGet_skydomeTexture(sampleCoord).xyz, 0.0); | ||
gl_FragDepth = farPlane; | ||
} |
Oops, something went wrong.