texelFetch returns empty?
Asked Answered
D

2

0

I'm trying to a pass single color to a shader via a texture3D at the coordinates 8, 65, 7.

I set my texture3D pixel to white, but when I draw it in the shader it appears as black.

Heres how I set up my texture3D:

    var width = 128
	var height = 128
	var depth = 128
	var texture3D = Texture3D.new()
	texture3D.create(width, height, depth, Image.FORMAT_RGB8)
	var image = Image.new()
	image.create(width, depth, false, Image.FORMAT_RGB8)
	image.lock()
	image.set_pixel(8, 7, Color("#ffffff"))
	image.unlock()
	texture3D.set_layer_data(image, 65)
	
	image = texture3D.get_layer_data(65)
	image.lock()
	print("Pixel color: ", image.get_pixel(8, 7))

material.set_shader_param("my_texture3D", texture3D)

print displays: > Pixel color: 0.498039,0.498039,0.498039,1

in my shader I've got this: vec4 result = texelFetch(my_texture3D, ivec3(8, 65, 7), 0); ALBEDO = result.xyz;

But my ALBEDO shows up as black...

Deangelo answered 9/10, 2021 at 16:53 Comment(0)
N
0

Have you tried (8, 7, 65) for the coordinates in shader?

Nimesh answered 9/10, 2021 at 17:47 Comment(0)
D
0

@xyz that works! thank you so much

Deangelo answered 9/10, 2021 at 18:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.