16.6 C
New York
Thursday, October 16, 2025

shaders – Difficulties for GPU rendering of a cone utilizing parametric equation


I am making an attempt to render a cone on the gpu for some results. I am utilizing the parametric equation supplied right here. I ended up with the shader under supposed to work with an unorderedaccessview goal (DX11). I am blocked within the rotating impact I wish to have, the cone appears to rotate however the rendered outcome is just not right as proven within the above image.
.

On this shader the rotation is utilized to the course D and to the 2 vectors U and V defining the airplane of the circle. Possibly these U and V vectors aren’t right or it’s my calculs for the rotation. The rotation is within the matrix world (rotation within the y axis solely).
What does completely not work is after I apply the total transformation to the calculated cone level within the “a” loop. The calcul I exploit is about as remark.

[numthreads(32,32,1)]
void CS_PostDeferred( uint3 nGid : SV_GroupID, uint3 nDTid : SV_DispatchThreadID, uint3 nGTid : SV_GroupThreadID )
{
    float2 Tex = float2(nDTid.x/SM_SCREENX, nDTid.y/SM_SCREENY);
    //it is a brut pressure shader for check. The cone is displayed solely at level display(0.25,0.25) 
    if ((Tex.x>0.249)&&(Tex.x<0.25)) 
    if ((Tex.y>0.2475)&&(Tex.y<0.25)) 
    {
           matrix M = World*ViewProjection;//cannot work with but. see under
           float3 O = float3(0,0,0);//high of cone
           float R = 200;//radius of cone on the base
           float H = 255;//top of cone
           float3 D = float3(0,0,1);//course of the cone
           float3 U = float3(0,1,0);//vector within the airplane of the cone circle if cone oriented in z axis
           float3 V = float3(1,0,0);//vector within the airplane of the cone circle if cone oriented in z axis
           //some rotation initially whitout rotating the pixel place 
           //provides some efficient rotation however the cone is just not appropriately rotating
           D =  normalize(mul( D, (float3x3)World ));
           U =  normalize(mul( U, (float3x3)World ));
           V =  normalize(mul( V, (float3x3)World ));
           float3 P;
           uint h;//present place alongside the entire top H
           for ( h = 0; h< H; h++)
           {
               float hH = h/H;
               float RhH = R * hH;
               uint a;//angle used to attract the circle at top h
               for ( a = 0; a < 72; a++ )//make a circle at top h
               0x000000FF;
               
           }
       }
   }

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles