I want to render the screen to just a portion of a render target.
The idea is to have the camera face one direction render everything scaled down to a portion of the rendertarget say the top left sixth of it.
Turn the camera 90 degrees in another direction with the same render target
Render to the top middle of it.
Repeat.
Id like to do this for all six sides of a cube, as im about to try to make a shadow cube map and im coding the cube atm… I did the regular shadow map before on a single plane but its not so great i’ve never tried to make a shadow cube yet.
Or
is that not possible
or a bad idea
ect…
Really i have no idea how to do a shadow cube map skybox’s are pretty simple but the shadow cube to me seems fairly confusing especially the part of figuring out were on which texture a pixel equates to when actually drawing the shadows.
I keep imagining about 6 if’s in a shader to boot im sort of thinking that isn’t the way its done ? Or is it ?
Oh nice is there any problems that can arise if you just use a single rendertarget for shadowmaping ? In relation to u,v coordinates i never did a shadow cube.
I would think it would be a bit cheaper to just use one render target.
Or is this just more confusing when your trying to figure out which part to get the depth from.
You are probably better off just using a RenderTargetCube instead.
I don’t think so. You won’t save any memory and it will probably be slower, because figuring out the correct uv coordinates makes your shader more complicated. With cubemaps you can just pass a direction into the texture lookup.
You have to do it this way for mobile (switching targets is too expensive to do more than strictly necessary) and any of the tiled/cluster lighting lighting methods anyways.
It’s pretty branchy though, even with most of it just being tables.
An alternative to doing the branchy coordinate conversion in the shader is to prebuild two mip-less cubemaps, one for face selection and another for indirection (bitwise operators can make it one RGBA16 but that chops away alot of hardware). The face selection contains the multiplier to collapse the sampling vector on the axis, and the indirection is the coordinate remapping. A bit more branchiness can ditch the indirection cubemap (packing an index into the face-selection Alpha). altDevBlog article
Shipped that approach, worked fine even on toasters.
Im going to try to get a cube shadow map working for sure.
I did a single texture shadowmap before though i never did get it to align perfectly to the scene.
It looked pretty good as far as i got it though. http://community.monogame.net/uploads/default/original/2X/b/b4edf50c4ad1a9ffa4d9ef9a21060816d0a7e541.png
I stoped when i realized i would need a cubemap, to do things properly and put it all on the backburner. I sort of need it now as its a missing piece that i need to tackle.
Kosmonaut that is impressive. Though im was just shooting for a barebones example.
Well i got a initial test up and running i won’t know how well its working till i continue it im tired. It appears to be shadowing, All though its a piss poor testing scene i tossed up a pic.
This turned out to be a crucial peice of the puzzle would not of known how to do this…