This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
0
Load a texture with an array and load into a shader.
Post Flair (click to view more posts with a particular flair)
Post Body
I am simply trying to load a buffer into a texture2d and to load that texture into an existing shader. This doesn't seem to be working for me.
So for example :
float TableData[12] = {
0.0, 0.0, 0.0 , 0.0, 0.0, 0.0 , 0.0, 0.0, 0.0 , -0.572215, -0.819053, 0.0415015 };
RayTracingPrimaryRays.cpp
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, Table)
FUpdateTextureRegion2D* Region = new FUpdateTextureRegion2D(0, 0, 0, 0, 2, 2); UTexture2D* TableTex = UTexture2D::CreateTransient(2, 2, PF_FloatRGB);
TableTex->UpdateTextureRegions(0, 1, Region, 2 * 3, 96, (uint8*)TableData); PassParameters->Table = (TAlignedShaderParameterPtr<FRDGTexture*>)TableTex ;
Then in the shader RayTracingPrimaryRays.usf
Texture2D Table ;
RayDesc Ray = CreatePrimaryRay(UV);
Ray.Direction = normalize ( float3 ( Table.SampleLevel(GlobalPointClampedSampler, float2(0,0), 0 ).x, Table.SampleLevel(GlobalPointClampedSampler, float2(0,0), 0 ).y, Table.SampleLevel(GlobalPointClampedSampler, float2(0,0), 0 ).z) ) ;
This code just doesn't seem to be working. I am trying to redirect the rays of the ray tracer by using a buffer of 3d floats. That's all. I don't like to shoot in the dark and try to get clarity about how I can accomplish this simple task. Can someone help me? Thanks.
Author
Account Strength
80%
Account Age
8 years
Verified Email
Yes
Verified Flair
No
Total Karma
64
Link Karma
52
Comment Karma
12
Profile updated: 4 days ago
Posts updated: 5 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/unrealengin...