#Hopefully this is a simple question
1 messages · Page 1 of 1 (latest)
Perspective. The level geometry is very simple, and is largely done via procedural shaders to get the desired B&W pixel look.
Ah, so they are in 3D space
My approach would be to scale the sprites via script based on their PPU and the screen size, if the screen size is allowed to change
But I'd expect that perspective will be a problem
It would be, since I'd need to calculate the distance from the camera too
There isn't really a way to place a sprite in 3D space while keeping it perfectly pixel perfect, since the perspective will always distort it somewhat
And ofc you can't scale sprites by non-integer amounts for any reason if you want to keep them undistorted
I don't know much about shaders but couldn't you just change the Vertex shader so that the sprite is always the right size?
You can, but you can't calculate a sprite's PPU in shader nor can you change its bounds
So it's not a great way to do it
PPU shouldn't be a problem, as I import all of them at the same value; I can hard code it into the shader, or expose it in the material
@harsh gull How about using an UI canvas in Screen Space - Camera and with Constant Pixel Size
Hadn't thought of that, lemme take a quick look at that
It's basically the same as your normal UI but also has a depth based on the camera
I imagine it might suit your purpose perfectly, as there needs to be very limited interaction between sprites and the world, I presume
Only interaction is positioning, but that's it.
Though I've never quite gotten the hang of screenspace camera, in terms of making stuff appear where it should. The sprite seems to not want to draw
You'll have to use images or raw images instead of sprites
Canvas is a different type of beast
I'm using Images, it's just weird how the placement works in relation to the canvas
Like plane distance seems to be where it draws, and if I change the plane distance then the Y height of the drawn image also shifts for some reason
But it is sorta working
Hm, with Constant Pixel Size in canvas scaler?
yup
Can't get the height to change by adjusting plane distance myself
Sorry, Y position, not height
Mostly got it working. If I place objects in the way, they occlude it, so that's good
I'll work with screenspace camera for now
Thanks for the advice!
Good luck!