i can do this santity testing part , marked “solution,” , but I did you get actual clip to work ?
could you share the cliping shader logic? I only see code to test the sampling works, i confirm that works.
is it the using the compute fork.? i tried the MG 3.8.1 release nuget it on android, opengl ,windows net 7 , and directx .I found that s0 also works now. its better and i can sample the registers, but w spirtebatch using a simple shader that actually CLIPs doesnt work, and its nt shown in the solution. this alwasy fails at the clipping branch or any attempt i made to clip if the mask isnt float4(1,1,1,1) white?
the sampling works, and i can i still pass the mask and the sprite as textures to the shader, via parameters, the combine those to a big sprite with mipmaps via to a rendertarget, is ok but for vectors i wanna just clip without making a huge 4k sprite, its way too expensive.
? shouldnt the float4 be 0 to 255 = 0 to 1 ( float) … with surface.Color
.the simple ifdoes work when passing in two tectures and making a sprite with transparency , in rendertarget which passing back a clippedsprite.
but uses tons of memory…
float4 MainPS(VertexShaderOutput input) : COLOR
{
float4 color = tex2D(screen, input.TextureCoordinates);
float4 colorM = mask.Sample(sampler1, input.TextureCoordinates);
//return color; // test code just to see if I can display both textures. (fine this works on 4 platforms i rigged , but its not CLIPPING anything off the screen sprite)… registers work and i pass only the mask… its better but its not doing the clip.
/// return colorM ; works…
if (all(colorM) == float4(1, 1, 1, 1)); //draw spiritewhite part of mask transparent background
{
return color**; //Never goes here this, worked if if use rendder target, should i use a nother shading branchless way some bitwise AND ? sorry im new to shaders or ive set my device surface wrong?**
}
return float4(0 ,0, 0, 0); // transparent.
}
i tried all ths too:
float4 color = tex2D(screen, input.TextureCoordinates);
float4 colorM = mask.Sample(sampler1, input.TextureCoordinates);
//clip(colorM.a -0.05); //tried all thsi branchless stufff.. doesnt do anything expected..
// return color;
// return ret;
// ret.a = ret.a * colorM.a;
// ret.a = colorM.a;
// return ret;
// return color.rgba * colorM.r;
// return color;
//if (colorM.b ==1) //there are built in stencis, depths, and other clipping stuff in Basic effect but I couldnt get them to work. the samples are from XNA times
//if (colorM.r == 1)
if (all(colorM) == all(float4(1, 1, 1, 1))) //this is what i did w render targets.. that did work
{return color;
}
return float4(0, 0,0,0); // transparent.
//tired branchless clip and operators to achieve clip , i think somehing is being culled as this is 3d graphics territory…I just cant see any differnce, and im new to stencils and all the settings, also in hsl if the a mask has a is zero, a neg clip(-1) should discard the pixel and thus clip… im using Surface.Color // it doesnt work on dx or openGL ive looked at shader forums, totally stuck … Please advise…i dont want to use render targets and pass 64 meg of image data to clip, i want to draw through a clip raster at 4k res, on the main device, no blending, should be just a simple thing iike if its 255,255,255,255 then drw otherwise dont draw.
I can’t find ia sample i want to add it to my shared x platform demo to help show how to quickly deploy and test single linked content and shared core game code, on 5 projects in one solution… ios, androind, mac linux, and windowsgl , winodwsdx, without maintaing links for new files like the current samples do for some reason… trimming and AOT must be off though for now on relese deployments for now. with net 7 you can get SIMD gaints with JITing thasts arent possible with AOT anyways.