Skip to content
Discussion options

You must be logged in to vote

Hi @Mephisto405

This is just a design choice with some performance considerations. I believe casting the output to a TensorXf would require an extra memory copy/shuffle which is not always needed, hence it is not the default behaviour.
Also, the typical use case is a 2D RGB texture lookup, in which case you would want a mi.Color3f which is literally just 3 separate arrays. So the list representation makes more sense here.

Here's an example of a conversion:

res = 32
texture = mi.Texture2f(dr.full(mi.TensorXf, 0.01, shape=(res, res, 3)))

x = mi.Float([1, 2])
y = mi.Float([3, 4])
points = mi.Point2f(x, y)

r, g, b = texture.eval(points)
tensor = dr.empty(mi.TensorXf, shape=(3, 2))

tensor[0,…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by njroussel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants