Page 1 of 1
[SOLVED] Isometric Depth Perception
Posted: Wed Aug 08, 2018 11:29 am
by Bogdan705
So I am working on a small isometric thing, and I recently added the ability to delete and place blocks. I built a staircase, jumped on top of it and realized that even though I was on the top it still looked like I was back on the floor, only being able to make out how high I am by carefully looking at overlapping tiles. So I decided to make the tiles that are further down darker, in order to add some sort of depth perception. Problem is, only the first 3 or 4 tiles at the bottom of the map actually have that depth perception and it's kind of faint.
That is what I use to get the 'depth', using it in setColor, z being the z axis ( up and down in my game )
Code: Select all
love.graphics.setColor(1 - ( 1 / z ),1 - ( 1 / z ),1 - ( 1 / z ))
While writing this I was thinking about maybe having the depth relative to the player's z position, but how would that look like in code?
Any ideas?
Re: Isometric Depth Perception
Posted: Wed Aug 08, 2018 1:48 pm
by raidho36
In isometric view it should be very obvious if you're climbing upstairs, as they'd be "diagonal" and you'd clearly see them. Can you post a picture?
To do the "relative z" you just subtract one from another!
Since this will now start at 0 and go positive and negative depending on relative height, you'd probably want to use a sort of sigmoid function to calculate color fade.
Code: Select all
local fade = 1 / ( 1 + math.exp ( -z ) )
love.graphics.setColor ( fade, fade, fade )
You'll have to tweak it to get to look right, and the engine doesn't support HDR color since version 11 (which I think was a stupid change) so you'd have to highlight the tiles at elevated level using some other means.
Re: Isometric Depth Perception
Posted: Wed Aug 08, 2018 6:15 pm
by Bogdan705
This is what I mean by depth perception issues :
https://www.dropbox.com/s/1zwv7b87k1143 ... 9.jpg?dl=0
https://www.dropbox.com/s/oikp4c6bv4do9 ... 7.jpg?dl=0
Same elevation, just walked south. I will try your solution and see if it works thank you.
Re: Isometric Depth Perception
Posted: Wed Aug 08, 2018 6:37 pm
by Bogdan705
Unfortunately it didn't work
, BUT I did find something that works and I could say I'm quite happy with the result.
https://www.dropbox.com/s/yo2qypqn69bne ... 6.jpg?dl=0
Code: Select all
fade = 1 / (math.abs(player.z - cube.z) * 0.5)
OR
Code: Select all
fade = 1 / (math.abs(player.z - cube.z) * settings.fade)
Since you know, it's good to have settings. I'm new to the forums, so I don't know how to lock a thread. Could you please tell me how to do so? And if I can't lock a thread, do I just rename it by adding "[SOLVED]" to the title?
Thank you
Re: [SOLVED] Isometric Depth Perception
Posted: Wed Aug 08, 2018 6:39 pm
by Bogdan705
Welp I just renamed it.