Skip to content

Commit

Permalink
Merge branch 'main' into multi_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
jstone-lucasfilm authored Jan 5, 2024
2 parents 5183320 + b48057e commit 4c73377
Show file tree
Hide file tree
Showing 64 changed files with 1,279 additions and 368 deletions.
4 changes: 2 additions & 2 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The current Voting Members of the MaterialX TSC are:
- Doug Smythe - Industrial Light & Magic
- Niklas Harrysson - Lumiere Software
- Orn Gunnarsson - Autodesk
- David Larsson - Adobe
- Andréa Machizaud - Adobe

### Stakeholders

Expand All @@ -68,8 +68,8 @@ The current Stakeholders of the MaterialX TSC are:
- Rafal Jaroszkiewicz - SideFX
- Lee Kerley - Sony Pictures Imageworks
- Lutz Kettner - NVIDIA
- Chris Kulla - Epic Games
- Bernard Kwok - Khronos Group
- Jonathan Litt - Epic Games
- André Mazzone - ILM
- Magnus Pettersson - IKEA
- Brian Savery - AMD
Expand Down
163 changes: 82 additions & 81 deletions javascript/MaterialXTest/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions javascript/MaterialXTest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.23.5",
"@babel/preset-env": "^7.23.5",
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.23.6",
"@babel/register": "^7.22.15",
"chai": "^4.3.10",
"copyfiles": "^2.4.1",
Expand Down
73 changes: 41 additions & 32 deletions javascript/MaterialXView/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions javascript/MaterialXView/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"author": "",
"license": "ISC",
"dependencies": {
"dat.gui": "^0.7.9",
"three": "^0.136.0",
"lil-gui": "^0.19.1",
"three": "^0.152.2",
"webpack": "^5.89.0"
},
"devDependencies": {
"copy-webpack-plugin": "^8.1.1",
"html-webpack-plugin": "^5.5.4",
"html-webpack-plugin": "^5.6.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.15.1"
}
Expand Down
60 changes: 8 additions & 52 deletions javascript/MaterialXView/source/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,59 +19,15 @@ const IMAGE_PATH_SEPARATOR = "/";
*/
export function prepareEnvTexture(texture, capabilities)
{
const rgbaTexture = RGBToRGBA_Float(texture);
rgbaTexture.wrapS = THREE.RepeatWrapping;
rgbaTexture.anisotropy = capabilities.getMaxAnisotropy();
rgbaTexture.minFilter = THREE.LinearMipmapLinearFilter;
rgbaTexture.magFilter = THREE.LinearFilter;
rgbaTexture.generateMipmaps = true;
rgbaTexture.needsUpdate = true;
let newTexture = new THREE.DataTexture(texture.image.data, texture.image.width, texture.image.height, texture.format, texture.type);
newTexture.wrapS = THREE.RepeatWrapping;
newTexture.anisotropy = capabilities.getMaxAnisotropy();
newTexture.minFilter = THREE.LinearMipmapLinearFilter;
newTexture.magFilter = THREE.LinearFilter;
newTexture.generateMipmaps = true;
newTexture.needsUpdate = true;

return rgbaTexture;
}

/**
* Create a new (half)float texture containing an alpha channel with a value of 1 from a RGB (half)float texture.
* @param {THREE.Texture} texture
*/
function RGBToRGBA_Float(texture)
{
const w = texture.image.width;
const h = texture.image.height;
const dataSize = texture.image.data.length;
const stride = dataSize / (w *h);
// No need to convert to RGBA if already 4 channel.
if (stride == 3)
{
const rgbData = texture.image.data;
const length = (rgbData.length / 3) * 4;
let rgbaData;

switch (texture.type)
{
case THREE.FloatType:
rgbaData = new Float32Array(length);
break;
case THREE.HalfFloatType:
rgbaData = new Uint16Array(length);
break;
default:
break;
}

if (rgbaData)
{
for (let i = 0; i < length / 4; i++)
{
rgbaData[(i * 4) + 0] = rgbData[(i * 3) + 0];
rgbaData[(i * 4) + 1] = rgbData[(i * 3) + 1];
rgbaData[(i * 4) + 2] = rgbData[(i * 3) + 2];
rgbaData[(i * 4) + 3] = 1.0;
}
return new THREE.DataTexture(rgbaData, texture.image.width, texture.image.height, THREE.RGBAFormat, texture.type);
}
}
return texture;
return newTexture;
}

/**
Expand Down
16 changes: 8 additions & 8 deletions javascript/MaterialXView/source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function init()
materialsSelect.value = materialFilename;
materialsSelect.addEventListener('change', (e) => {
materialFilename = e.target.value;
viewer.getEditor().clearFolders();
viewer.getEditor().initialize();
viewer.getMaterial().loadMaterials(viewer, materialFilename);
viewer.getEditor().updateProperties(0.9);
viewer.getScene().setUpdateTransforms();
Expand Down Expand Up @@ -83,20 +83,20 @@ function init()
viewer.getEditor().initialize();

const hdrLoader = viewer.getHdrLoader();
const fileLooder = viewer.getFileLoader();
const fileLoader = viewer.getFileLoader();
Promise.all([
new Promise(resolve => hdrLoader.setDataType(THREE.FloatType).load('Lights/san_giuseppe_bridge_split.hdr', resolve)),
new Promise(resolve => fileLooder.load('Lights/san_giuseppe_bridge_split.mtlx', resolve)),
new Promise(resolve => hdrLoader.setDataType(THREE.FloatType).load('Lights/irradiance/san_giuseppe_bridge_split.hdr', resolve)),
new Promise(resolve => hdrLoader.load('Lights/san_giuseppe_bridge_split.hdr', resolve)),
new Promise(resolve => hdrLoader.load('Lights/irradiance/san_giuseppe_bridge_split.hdr', resolve)),
new Promise(resolve => fileLoader.load('Lights/san_giuseppe_bridge_split.mtlx', resolve)),
new Promise(function (resolve) {
MaterialX().then((module) => {
resolve(module);
});
})
]).then(async ([loadedRadianceTexture, loadedLightSetup, loadedIrradianceTexture, mxIn]) =>
]).then(async ([radianceTexture, irradianceTexture, lightRigXml, mxIn]) =>
{
// Initialize viewer + lighting
await viewer.initialize(mxIn, renderer, loadedRadianceTexture, loadedLightSetup, loadedIrradianceTexture);
await viewer.initialize(mxIn, renderer, radianceTexture, irradianceTexture, lightRigXml);

// Load geometry
let scene = viewer.getScene();
Expand All @@ -122,7 +122,7 @@ function init()

setLoadingCallback(file => {
materialFilename = file.fullPath || file.name;
viewer.getEditor().clearFolders();
viewer.getEditor().initialize();
viewer.getMaterial().loadMaterials(viewer, materialFilename);
viewer.getEditor().updateProperties(0.9);
viewer.getScene().setUpdateTransforms();
Expand Down
Loading

0 comments on commit 4c73377

Please sign in to comment.