Random "work in progress" shots

category: general [glöplog]
Just prototyping some texture based font rendering trick to get some halfway decent cleartype quality on screen. Create font with cleartype quality, render glyphs in pure white using plain GDI (MM_TEXT, TRANSPARENT), then upload texture, use nearest filtering, you know the deal. Render two passes:

Pass 1, always white color:

Code: glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); glColor3f(1.0F, 1.0F, 1.0F); DrawText(....);

Pass 2, render with text color:

Code: glBlendFunc(GL_ONE, GL_ONE); glColor3f(r, g, b); DrawText(....);


BB Image

BB Image

If you just want to render white or bright color text, you could cheat a bit... but the darker the color the more it fades away, so for white or grays it works okayish - simply assume GDI output is premultiplied:

Code: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); glColor3f(alpha, alpha, alpha); // Or some bright color.

I'm surely not the first one to come up with this, but anyways, sharing is always nice ;-)
added on the 2017-01-24 14:42:59 by EvilOne EvilOne
Couple of materials from Gestalt (with each one containing 5-6 custom nodes, because ue4 does everything for you!)

BB Image
BB Image
added on the 2017-01-29 14:18:02 by ton ton
added on the 2017-01-31 04:14:20 by sigflup sigflup
BB Image
That looks awesome hardy!
added on the 2017-01-31 14:57:45 by xTr1m xTr1m
Could you zoom in here and put 3 transparent cubes behind another? I'm intrigued :)
BB Image
added on the 2017-01-31 14:59:28 by xTr1m xTr1m
added on the 2017-01-31 15:00:05 by xTr1m xTr1m
xTr1m: It´s not demo-related! It´s just modded Minecraft...i posted it to show that i am in a state of not working (on demos or games) but on a Minecraft-World these days!
(still trying to find a solution to pay 25$ to Google via CreditCard (which i dont have/get and noone i know has so he could pay it for me; one can´t pay via bank transfer or paypal, just stupid CCs!) so i get access to the Android Developer Console so i can release my Android-Game finally! This bullshit put me into this state of stagnation and idling around...demotivated to do anything at all for 2 months now, thinking about suicide already! I guess now that i am almost back into hartz4 (starting next month) and my game not yielding any money thanks to this hurdle i can aswell start boozing again after 18 months of living Straight Edge! All hope is lost here! My life sucks once again!)
Hardy, du hast FB post...
added on the 2017-01-31 15:20:50 by Virgill Virgill
In my Spheremarcher i travel constant (huge) steps once i hit sth transparent/refracting...until i get a positive distance again (obviously only works with signed Distance Estimations)...then i backtrack the positive distance on my ray and travel further until i hit sth else.
I had a look into other peoples approach to Refractions on ShaderToy (first time i looked into other peoples shader-code ever) and realized everyone else is just jumping several units on the refracted ray then marching backwards on that ray until they hit the same object again. I really don´t like this approach, it´s kind of error-prone because of the possibility to step in/over other geometry and so hitting that other geometry instead of the same object again while backtracking.
BB Image

Although i guess it´s not useful to you anymore, now that you know it´s just minecraft i made a zoomed screeny.
hardy: cool scene! Needs AA tho ;)

Re. refraction, 'constant large steps' sounds like 'might miss surfaces'. But this whole subject is a complete pain. What if you hit a non-transparent surface *inside* a transparent one? There's lots of tricky cases to handle.

Also, glass isn't only transparent, it's reflective based on fresnel value. How do you deal with *both* refraction and reflection on 1 ray? Ugh.

One of my better attempts to deal with this: https://www.shadertoy.com/view/MldSW8 (handles refraction, reflection, and surfaces inside the glass, but the fresnel-reflection from the glass is fake, not a real ray).

I'm still learning path tracing. Got quality and speed up nicely (this is 60fps now), still not got decent geometry. Need to get fast triangle intersection and octree or BSP traversal figured out, this shit's hard.

BB Image
added on the 2017-01-31 19:00:27 by psonice psonice
@hardy: Sorry to hear about your troubles.
Gotta say, those are some nice screenshots of Minecraft!

I've redone the CRT effect:
BB Image

And added a cool animated background!
added on the 2017-01-31 19:08:20 by TomoAlien TomoAlien
TomoAlien: is the background a demo effect or part of the pic? I like both :)
added on the 2017-01-31 19:15:12 by psonice psonice
TomoAlien: is the background a demo effect or part of the pic? I like both :)

The background's a demo effect.
added on the 2017-01-31 19:26:11 by TomoAlien TomoAlien
BB Image

Although i guess it´s not useful to you anymore, now that you know it´s just minecraft i made a zoomed screeny.

Does Minecraft support order independent transparency? Do the cube faces look right form every point of view? At least from that perspective everything looks right.
added on the 2017-01-31 21:23:58 by xTr1m xTr1m
xTr1m: i have to admit i haven´t looked into the shader myself (i really hate seeing other peoples code, so i avoid it whenever possible...i want to riddle myself until i found a good solution!) but you can have a look into the complete shader if you want:
Robobo´s Shaders for Minecraft
Can´t say anything abvout the underlying rendering either, as i never looked into minecrafts sourcecode...but as far as i understood it´s software-rendering via javascript.

psonice: Where´s the problem with Refractions/Reflections at the same time?
1.) Travel on Ray until you hit a refracting object
2.) Save hitpoint, add baseColor of refracting object to pixelColor
3.) refract ray and travel through the object, refract again where you leave the object, travel until you hit sth else, add color of hit object to pixelColor
4.) reset ray to saved hitpoint, reflect it, travel until hit, add mirrored objects color to pixelColor
5.) Done!

Where it gets tricky is indeed when you hit another refracting object with your refracted ray...

Test-Scene 2013
BB Image

About hitting non-refracting geometry inside a refracting object:
Try to avoid it or if you really want to have for example some cube inside a refracting sphere, simply just use a hull of a sphere (boolean of sphere - slightly smaller sphere), this way you always leave the refracting hull before you hit sth again...and if you hit the sphere again next it gets tricky again like said above...

Test-Scene 2014
BB Image
oops, first screenshot is from 2013 aswell, but not the one i wanted to show here, and i cant find the one i wanted to show originally right now! (the one with refractions/reflections in one...but you can watch some of my last 4/8ks...they do both of it at the same time in some parts)
let me search again tomorrow, gotta meet my bed now i guess! ;)

P.S.: The journey of 25$ annoying the hell outta me ended today! :) I guess if nothing helps anymore you need to rant about it everywhere so you get help from outside eventually! Finally my first lame game will get released...in some more weeks from now! (I worked on professional games before, but this is 100% coded by me and also just a first test for android-games, thats why it got a bit lame, haha!)
hardy: yeah, first time i tried this i ended up with a kind of "stack of rays" setup. If a ray hits a surface where it splits (i.e. glass), it refracts, adds the reflection ray to the stack. Etc etc.

But, it gets messy... if you want 100 iterations, maybe the first ray uses 99. Or maybe you'll limit to 10 rays, and allow 10 iterations each, and your scene looks like shit :D

Or, you have 10 rays max. and allow 100 iterations each, and you have to carefully plan your scene so you never have 1000 iterations over a big area. Ugh.

I'm really loving path tracing for this. Forget the whole problem. If a ray hits glass, roll the dice, decide whether it's reflected or refracted. There's only ever 1 ray, and while that would look like shit, if you average 100 rays per pixel the problem disappears :D

...if only we could use all the beautiful CSG tricks and mod and "x + noise" etc. we get in raymarching with path tracing. Spheres and cubes are boring.
added on the 2017-02-01 00:29:55 by psonice psonice
I've implemented raymarched glass that supports glass within glass behind glass :) I've also implemented OIT in my soon to be released engine, however I see no need to use OIT in a demo where you can spend all your time on rendering on a high end rig like the compo machine, what do you need OIT for when you can do "real" glass and volumetrics ? Just sayin :P
added on the 2017-02-01 05:07:13 by LJ LJ
PS: no overstepping required, single ray but no chromatic abbreviation as it would require more rays, could probably fake it using post magic though... or get a 1080 rig and cast more rays ;)
added on the 2017-02-01 05:12:22 by LJ LJ
hardy: nothing in background ?
added on the 2017-02-01 09:47:20 by Barti Barti
LJ: I wondered about the OIT question - if it's voxel rendering, it's basically a form of ray tracing so you'd hit the surfaces in order anyway right?

Hmm... and your comment on chromatic aberration... now I'm doing path tracing and i already have lots of rays (~100 per pixel atm), i should try this :D Just need to adjust material colour based on incident angle, which is pretty trivial.
added on the 2017-02-01 10:02:34 by psonice psonice
Barti: those are just old Test-Scenes. The lower one would be quite showable in an intro, but i never intended to use those scenes in an intro, only made them to have a good testing scenario for new features.
...but as far as i understood it´s software-rendering via javascript.

added on the 2017-02-02 11:14:14 by MandelBOT MandelBOT