Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/jsm/shaders/VolumeShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ const VolumeRenderShader1 = {

vec4 apply_colormap(float val) {
val = (val - u_clim[0]) / (u_clim[1] - u_clim[0]);
float n = float(textureSize(u_cmdata, 0).x); // see #33842
val = (val * (n - 1.0) + 0.5) / n;
return texture2D(u_cmdata, vec2(val, 0.5));
}

Expand Down
8 changes: 4 additions & 4 deletions src/nodes/accessors/Batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { varyingProperty } from '../core/PropertyNode.js';
*
* @param {Node<texture>} colorsTexture - The colors texture.
* @param {Node<int>} id - The instance or batch ID.
* @returns {Node<vec3>} The retrieved color.
* @returns {Node<vec4>} The retrieved color.
*/
const getBatchingColor = /*@__PURE__*/ Fn( ( [ colorsTexture, id ] ) => {

const size = int( textureSize( textureLoad( colorsTexture ), 0 ).x ).toConst();
const j = int( id );
const x = j.mod( size ).toConst();
const y = j.div( size ).toConst();
return textureLoad( colorsTexture, ivec2( x, y ) ).rgb;
return textureLoad( colorsTexture, ivec2( x, y ) );

} );

Expand All @@ -44,9 +44,9 @@ const getIndirectIndex = /*@__PURE__*/ Fn( ( [ indirectTexture, id ] ) => {
/**
* TSL object representing a varying property for the batching color vector.
*
* @type {VaryingNode<vec3>}
* @type {VaryingNode<vec4>}
*/
export const batchColor = /*@__PURE__*/ varyingProperty( 'vec3', 'vBatchColor' );
export const batchColor = /*@__PURE__*/ varyingProperty( 'vec4', 'vBatchColor' );

/**
* TSL function representing the vertex shader batching setup.
Expand Down
Loading