@Alkher wrote:
Hi!
I'm trying to render 1 or many sphere as this: for each sphere, from its center to the border, alpha = distance_from_the_center) /radius.
Would I have to do this using a raycasting method ?Can't I just for a start get the vertex's position, the center, and use the distance between the two ?
In the vertexshader, is input.position the position of the vertex in object's space ?
If right, then I should just have to do length(normalize(input.position-world. 4142_43)), isn't it ?When I do
float4 worldPosition = mul(input.Position, world); float redamount = length(normalize(output.WorldPos) - normalize(output.PositionSphereCenter));
and in pixelshader
return float4(redamount,0,0,1);
I've got the red decreasing when the pixel gets away from (0,0,0) as expected, but not in the object space when getting away from the center of the sphere
Posts: 8
Participants: 3