开发者

HLSL geometry shader texture look up

开发者 https://www.devze.com 2023-03-16 23:03 出处:网络
I\'m trying to implement marching cube algorythm in my geometry shader. So i place my datagrid into a Texture3D. Now i want to look up the data in the geometry shader and this trows an error \"cannot

I'm trying to implement marching cube algorythm in my geometry shader. So i place my datagrid into a Texture3D. Now i want to look up the data in the geometry shader and this trows an error "cannot map expression to gs_4_0 instruction set"

This is the line of code开发者_Go百科 where he trows the error

cubeVale[0] = dataFieldTex.Sample( samPoint, float3(k, j, i)).a;

I hope someone can help me out here.

ty


Sample() only works in pixel shaders, since it automatically computes the mipmap lod to use by taking derivatives of the texture coordinates, and derivatives are only available in pixel shaders.

MSDN has a list of texture object methods and the shader profiles they work in. For the gs_4_0 profile your choices are Load(), SampleLevel() or SampleGrad(). You probably want SampleLevel(), especially if your Texture3D only has one mip level.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号