My next pathetic attempt with shadows - help

Found it…

As I said, it was on the very beginning…
The 4th component of the LightColor vec4 means the type of light. It was missing!
In renderer’s code it was:
material.setVector4(“LightColor”, light.getColor().toVector4f());
but I’m using RGB only while making colors, the A value is always left to 0…

My fault, sorry for wasting your time. And thank you.

Small improvement from me:

	vec3 lightVector = m_LightPos - worldPos.xyz; //vLightPos.xyz - worldPos.xyz;
	float dist = length(lightVector);
	if (dist > (1.0 / m_LightRadius)) return;

By using this code at the very begining of main() in frag we can save some GPU power. Notice that the light should only affect pixels in its range, so doing calculations beyond this value is just a waste of FPS. On my GPU with 3 lights I had significant loss of FPS. Now, with that code everything is Ok.

I wonder if there is a way to move it into vert.

How its look now:

2 Likes

Ok, let’s say I have such code:


	@Override
	protected void controlUpdate(float tpf) 
	{
	   ...
	   ...

	   float radius = f(time, something); 
	   _light.setRadius(radius);

	   ...
	   ...
	}

The _light is the one that PointLightShadowRendererPretty have, it is not connected to any node.
By doing setRadius I have a terrible FPS (1-2) and Shaders(M) value is increasing all the time.
Radius is passed as material parameter, it is not possible that for every new value the renderer is compiled again…

I don’t understand…

It might be a material parameter that is linked to a #define… in which case, the shader will get recompiled every time. The j3md will tell you.

It was that, I just found that by debugging the JME’s code (notifyParamChanged). I had some extra defines for my silly test purposes.
Thank you.

Thanks to all of you we are able to continue our work. Check out our new video: http://youtu.be/muB8hky_Ru0
Ignore the small bug with item placement.

And what do I need to do to have my own project topic here? Some place where I can post some interesting news about the project? I was trying to contact forum admin but so far no one replied.

Still no answer about the project?
Anyway, check the latest video: Untitled Dungeon Game - some new textures, sounds - YouTube

@FrozenShade said: Still no answer about the project?

The guy who would normally do it is off volunteering in refugee camps or something… also the site is a bit in flux at the moment. Not particularly helpful, I know, but at least you know we aren’t ignoring you completely.

I am seeing a lot of texture / shader switches in that video … It might run at 60 fps on your setup but on other people’s setup it might be a lot less efficient.

Are you putting your whole scene into the Transparent Bucket by any chance?

Anyway before having topic, you can start by a thread under User Code & Project with name of your project as title.

@FrozenShade said: Still no answer about the project? Anyway, check the latest video: https://www.youtube.com/watch?v=UfwS3PQcV0M
Looks pretty good ;)

It does look really nice. Nice feel to it.

…for some reason it feels like we are walking waist-high, though. Maybe it’s just because there are no obvious references for scale yet.

@pspeed said: The guy who would normally do it is off volunteering in refugee camps or something... also the site is a bit in flux at the moment. Not particularly helpful, I know, but at least you know we aren't ignoring you completely.
Ok, I understand.
@Momoko_Fan said: I am seeing a lot of texture / shader switches in that video .. It might run at 60 fps on your setup but on other people's setup it might be a lot less efficient.

Are you putting your whole scene into the Transparent Bucket by any chance?

I have 40-60fps with vsync on an old 9600GT graphics card, it depends on the visible lights count. And I don’t know if it’s good or bad value.
Here, for every light source, the shadowmap is calculated and unshaded surfaces are drawn with additive blending. This is in contrast to the current method of drawing shadows, you can find more details about that just few pages before in this topic.
Currently I made few optimizations. First of all, my PointLightShadowRenderer can be enabled or disabled and on every camera movement I’m testing all the lights if they are visible by the player. It means if they (or their environment which should be lighened up) are in frustum angle/range of the camera. The second test is based on Bresenham’s algorithm for line drawing - with my ‘tiled’ structure of the dungeon I can determine if the player should see the light, or maybe the light is just in the next corridor or in closed room. This one was disabled for the video purpose (the last few seconds when camera runs behind the walls).
For now I have no other ideas how to speed it up a bit more, but maybe in the future I would be able to do that.

@pspeed said: It does look really nice. Nice feel to it.

…for some reason it feels like we are walking waist-high, though. Maybe it’s just because there are no obvious references for scale yet.

Or maybe you are just a small person in a big corridors. Much better than claustrophobical feeling when the ceiling is just above your head :wink:

@nehon said: Looks pretty good ;)
Thank you, nice to hear that ;)
@david.bernard.31 said: Anyway before having topic, you can start by a thread under User Code & Project with name of your project as title.
I'll wait a bit more, and do that if noone answer.

Hi FrozenShade it looks like we are both doing very similar thing (http://hub.jmonkeyengine.org/forum/topic/general-questions-dungeon-crawler/page/3/#post-299831)

Yours is looking good so far, very Dungeon Master :slight_smile:

Best of luck with the project

@Perjin

I was wondering why all the shadows look so sharp and PCF just does not works… Looks like it is caused by that light=min(shadow, light); calculation. As I understand, it’s your way to clean some artifacts, and I’ve noticed that it removes some vertical dark lines that appear for example on columns, and which I’m unable to remove by adjusting the poly offset.

The important thing is that those artifacts appears only on few objects, so there is no need to ‘ruin’ the shadows on the whole scene. I solved it by adding new material parameter which is used in conditional compilation to choose between your light=min(shadow, light); and my own light*=shadow;

Here are the results:
http://s28.postimg.org/is0g4kg71/3ddu51.png
http://s18.postimg.org/5wklp9yt5/3ddu511.png