You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone, my name is Lev and I'm struggling with a problem.
I'm creating a custom terrain (the same is TR.Stride). I'm doing the same thing as in Terrain_Blend_Height.sdsl shader. I have main material and some layers on it. For each layer I set same ComputeColor shader which returns float4(1, 0, 0, 0) based on Texture coordinate color. When I try to pass a texture a get an error on material.
Here is my code:
shader MaterialGeneration : ComputeColor, PositionStream4 {
compose ComputeColor R;
compose ComputeColor G;
compose ComputeColor B;
compose ComputeColor terrainSize;
compose ComputeColor textureHeight;
compose ComputeColor textureWidth;
override float4 Compute() {
//Texture.xy == float4(1, 0, 0, 0);
float2 mapCoordinates = float2(streams.Position.x, streams.Position.z);
mapCoordinates.x = mapCoordinates.x * textureWidth.Compute().x / terrainSize.Compute().x;
mapCoordinates.Y = mapCoordinates.y * textureHeight.Compute().x / terrainSize.Compute().x;
mapCoordinates += float2(textureWidth.Compute().x / 2, textureHeight.Compute().x / 2);
if (Texture[int(mapCoordinates.x), int(mapCoordinates.Y)] == float4(R.Compute().x, G.Compute().x, B.Compute().x,1))
return float4(1, 0, 0, 0);
return float4(0, 0, 0, 0);
}
};
I'm passing texture from game studio, so does anyone have and Idea how I can rework my shader. My shader need to get Texture from game studio and then return float based on coordinates color.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone, my name is Lev and I'm struggling with a problem.
I'm creating a custom terrain (the same is TR.Stride). I'm doing the same thing as in
Terrain_Blend_Height.sdsl shader. I have main material and some layers on it. For each layer I set same ComputeColor shader which returns float4(1, 0, 0, 0) based on Texture coordinate color. When I try to pass a texture a get an error on material.
Here is my code:
shader MaterialGeneration : ComputeColor, PositionStream4 {
compose ComputeColor R;
compose ComputeColor G;
compose ComputeColor B;
compose ComputeColor terrainSize;
compose ComputeColor textureHeight;
compose ComputeColor textureWidth;
override float4 Compute() {
//Texture.xy == float4(1, 0, 0, 0);
float2 mapCoordinates = float2(streams.Position.x, streams.Position.z);
mapCoordinates.x = mapCoordinates.x * textureWidth.Compute().x / terrainSize.Compute().x;
mapCoordinates.Y = mapCoordinates.y * textureHeight.Compute().x / terrainSize.Compute().x;
mapCoordinates += float2(textureWidth.Compute().x / 2, textureHeight.Compute().x / 2);
if (Texture[int(mapCoordinates.x), int(mapCoordinates.Y)] == float4(R.Compute().x, G.Compute().x, B.Compute().x,1))
return float4(1, 0, 0, 0);
return float4(0, 0, 0, 0);
}
};
I'm passing texture from game studio, so does anyone have and Idea how I can rework my shader. My shader need to get Texture from game studio and then return float based on coordinates color.
Beta Was this translation helpful? Give feedback.
All reactions