the old quarter
(294 chars)
local w,l,a,s,x,h,c,u,v,b,p,q=0::_::u=cos(t()/180)<<8&-1v=sin(t()/150)<<8&-1for i=0,86do w=(w+71)%192x=max(w-63.5)-8s=0for y=max(127-w-w)-16,min(256-x-x,127)do p=x+u q=y+v a=p\12c=a+q\12if(c!=b)h=((a~c)&15)/3b=c l=h s-=.29if(s<h)l+=2s=h pset(x,y,l+(p~q)%3/3)x+=.5end end?"⁶1⁶!5f11█ˇ5●67" goto _ |
This one is really amazing 👀
I'm pretty sure you've already shared this on Discord but still unbelievable how the shadow cast on lower blocks is so spot on, all in a few chars. 💯⭐
@Heracleum Thank you! This cart is new, but you're right that the underlying effect isn't - it's based on the same idea as https://6t.vc/@luchak/111218905681615398 , which in turn means the original idea comes from Exoticorn / Icebird.
The changes here are:
- Some bugfixes - mostly fixing iteration ranges to reduce overdraw and avoid static-y overlap artifacts
- New scene setup, with a different heightfield and a moving camera. Took a bit of time to figure out a way to set up a more city-like landscape that didn't use too much code or have problems with light leaking through corners.
- Lots of constant tuning: tuning camera motion, switching dither pattern to something that looks more brick-like, different color palette, starting each image "slice" offscreen to pick up shadows from offscreen blocks (not nearly as important in the original cart), lots of tiny tweaks to keep visible aliasing as low as possible.
- One non-change: I kept the grid aligned to the screen. Rotating it helped to mask aliasing and could sometimes help with light leaks too, but it always looked too messy.
Oh, also! The reason the shadows look good is because they're real. :) Or at least much less faked than I thought they were when I first saw the effect. The cart iterates image slices parallel to the light direction, updating the height of the boundary between light and shadow at each pixel.
[Please log in to post a comment]