Hello again
I'm now trying to write a 2D shadow shader and need all the rendered object-positions and bitmaps for that.
I want to pass them in two arrays to the shader, but since the size of the arrays seems to be fixed by the config file.
Also the shader asks for every element of the array with pstPayload->s32ParamIndex, right?
So the array size is probably really fixed by the config?
How do I now get the bitmaps and positions of all the rendered objects into my shader? :S
Comments
What kind of effect are you trying to make?
I've overread the "constant expression" part. :ohmy:
I want to do something like that
The important thing to me would be to create a black/white texture with the objects being black and everything being white.
I will probably ignore everything but that.^^
I just can't imagine how to properly get the needet information into the shader.
I should be able to handle everything else just fine. I hope.
Haven't read the article yet but that reminds me of a test I did in the title screen of mushroom stew:
You can have a look at the shader source but it's definitely not the most efficient one.
I'll read the details for the proposed technique tonight but that shouldn't be too bad to get you on track I think.
For drawing the black/white image, the easiest way to do that is to render your scene to a texture (see the compositing tutorial) with all object's color set to (0, 0, 0) or by simply adding a shader to them that'll write any non-transparent pixel with a (0, 0, 0) color.
If you don't want to remove the shader manually everytime you want to render the actual object, I suggest to have a shader that takes a single bool parameter to know if you're rendering the shade or the actual object and depending on the case it'll output the actual pixel color or black.
You really don't have to read the technique. I won't really use it.
The black/white map just got stuck in my head.
I will probably do the rest much more inefficient and simple.
I read his technique real quick but I don't think it'd be much faster than my brute force approach in the end, on the shader-side I mean, adding compositing to the mushroom stew example should help a lot but it wasn't quite entirely in orx supported back then.
If I were to make 2D shadows for a game, I'd probably go for a polygon approach that would be much more efficient but not pixel-perfect, unfortunately.