It's trivial to generate a 3D impression, all you need to do is to separate two color channels, say red and green. This can be done in the wave or frame equations and does not require any shader support.
For any object you want to show: draw it twice, one in red and one in green, horizontally displaced (NOT vertically !!!) The displacement between red and green determines the depth. It's as simple as that. For distant objects, the displacement is zero. Displacement increases the closer the object is meant to be perceived. A displacement of 1cm or so should not be exceeded otherwise the image may fall apart - which is painful.
Obviously you don't need any particular milkdrop version to do that.
The 3D feature in MD1 was meant to work with common presets, none of which however bothered to draw a separate red and green channel... Therefore (I guess) MD1 used the zoom effect, based on the idea that most presets use zoom to simulate a movement towards the screen: MD1 manipulated the zoom, and moved the red channel red slightly to the right hand, and green to the left hand side. Imagine dx positive for red and negative for green. This would slowly draw red and green apart as the picture moves (is zoomed) towards you.
Concluding: To create 3D or "anaglyph" presets in MD2, you have two choices:
1. Use only white for the wave/shape equations. Emulate the stereo function of MD1 by code in the warp shader, separating red and greeen by something like
2. Duplicate your wave or shape functions, use red for one copy, greeen for the other (NO color mix, no blue !!!) and displace the copies horizontally by a constant proportional to the inverse of the depth (z). For instance, dis =1/infinity = 0 for the background, dis = 1cm for the objects meant to "stick out" of the screen... not sure if I could make this clear. I can provide an example preset, but I need glasses first to make sure it works.
This method does not depend on the zoom and should deliver much better results.
Either way, you'll need red-green glasses and you will perceive the preset, although stereo, in grayscale. Colors are not feasible.
And, obviously, any tricky functions in the comp shader, which change the colors or mix red and green channel, will destroy the effect.
in principle yes but then you need to need to generate the depth in the comp shader and it will be linked to the screen (uv) rather than the picture content
Say you draw a dice by wave equations, then you can readily draw it in 3D because you know the coordinates x,y,z of all corners.
The comp shader does not know this so what will you do? A uniform rg-separation will just move the whole screen towards you. Make the separation dependant on uv - this might give interesting effects, you might for instance get a globe shape when you make the separation proportional to rad. However the picture content - i.e. the cube - will just appear to be painted on that globe, and not look itself spatial.
Comment