Improved shadow renderer

…sorry… it’s like a nervous tick. :slight_smile:

awsome! cant wait to see it in the engine :smile: keep the good work up.

@pspeed so there is still one light left :wink:

Awesome.
For the core change, just document in your PR.

Gorgeous ! Can’t wait to see that in the engine ^^

I think i have most things working in a reasonable way now.
In this screenshot is one directional, three point and four (yes four) spot lights with shadows and four more point lights without shadows. (if too many shadow casters are declared the shader won’t compile at some point)

Here are the changes i had to make in the engine:


One part are array textures as render targets and the other part was fixing a bug with shader generation.
The multiplicity for array variables was ignored in some cases, so i fixed that.

If there are no objections i will make a pull request.

The Shadow renderer can still be found here:

I created a new shadow renderer which handles all light types, a maximum number and resolution for each light type needs to be specified.
I would like to change the need of a special shadow material, currently i’m using it to set the number of lights already rendered, which is used in the shader to evaluate the correct shadow map for each light.
I’m also using a special light filter which will sort the shadow casting lights to the front in a specific order, but i don’t see a way around that.
Currently there are no special shadow filters available. (Filtering is somehow broken for spot and point lights anyway, but i didn’t look into that yet.)
Then i have a bunch of material parameters which are used by the shadow renderer and it would be nice if the user using the shader node would only have to connect the parts which actually interact with the rest of the shader,
maybe declaring material parameters as part of the shader node or something.

If someone wants to try it i hope i was succesfull in using gradle, it should be only necessary to perform a gradlew install with my engine changes and then the shadow project should work. (I’m using a nvidia 670m card with windows, so I’m fully expecting this to not work at all with AMD and/or OSX :wink: )

12 Likes

Great work man!

I’d like to get this into core, but not for 3.1 if you don’t mind, so could you instead make a PR against the PBR branch?

Ok I’ll do that.

2 Likes

I did the pull request, tell me if there is a problem with it:

Also changed the lighting shader in the shadow renderer project to match the world space ligths in PBR branch.

1 Like

Is anything happening with this? It looks like a really nice improvement. I see the engine changes pull request went through, but the PreFrameShadowRenderer project has a few errors that suggest the implementation has since drifted.

1 Like

Yeah would be cool, I wait for that :slight_smile: But when I got it correctly this is in the head, that mean it will not be available sooner than 3.2 version.

I can update the project if anyone wants to use it, but @Momoko_Fan was working on a shadow renderer ( (April 2016) Monthly WIP screenshot thread ) so i didn’t continue with mine. Also I’d rather contribute to Momoko Fan’s Version as soon as he is ready to share it.

2 Likes

I would use it :slight_smile: but I’m currently not in a hurry and have plenty of stuff to do for the mechanics…

Is’nt this already available in the 3.2 git master? At least I rmember seeing that pull request being merged.

The PR only contained the core modification to be able to implement the renderer
The renderer is in another repo.
Kirill is working on a renderer that is in the experimental branch of the engine I think

like the princess :wink:

2 Likes

Ah, no problem. Just glad to hear it’s still in the works. I’m in no rush for it to be completed right now.

I know I’m reviving this from the dead, but did this ever make it? And if not, why not? Are you interested in picking this up, @Perjin ?

1 Like

I think “this” happened to it…

And we should check on the status of that branch also. I’m sure there are good ideas in it if nothing else.

This is @Momoko_Fan PR :

It breaks backwards compatibility, mainly with custom lighting shaders. Also there are some significant core changes that require user testing. Might make sense to include in jME 3.3