[Effect] Normal Map Extended 1.01 (Updated -13 Jul)

Share your Construct 2 effect files

Post » Thu Jul 16, 2015 9:46 pm

Tranquilo

The star effect didn't present in layout called "Spotlight" you made, so I made this screenshot for no reason since I opened .capx, then I choose another layout is called "NormalMap_layout"

There no much difference in my .capx , but only one thing is <blend-backgrounds> is true as you can make real effect preview in editor.

There is a design problem:

If Light sources are counted as:

Light2 = 1
Light3 = 1

They work fine, everything is fine, todo esta bien


Otherwise,

Light2 = 1
Light3 = 0


It becomes black.

Another otherwise,

Light2 = 0
Light3 = 1


It becomes black, too.


Im not reporting an error, it's just design. What's the point to use as parameters ----Light2 and ----Light3, if is 0, it always become black



btw, Image
B
97
S
35
G
29
Posts: 3,139
Reputation: 28,371

Post » Thu Jul 16, 2015 9:55 pm

I updated with the Blend-background to True and put the NormalMap layout with the planets first.

The other layout is to test the Spotlights but i can't get working so i leave that at the moment.

-

The problem of the lights enable/disable is that with 1 they multiply by their efect for 0 the efect becomes 0. In my case if i set some light to 0 when i run the layout works correct, simply this light is not visible.

So to be clear, in your case in the moment you put 0 to any light, when you run the layout the texture with any light at 0 comes entire to black? I mean, in my case if i put 0 in the preview looks black but when runs is all lighted except the one i disabled, but if i understand well, in your case when one is 0 turns all the texture to black ¿Correct? is this?

Edit: In that case i guess i will have to use an IF instead the multiplier. Tomorrow i will try.
B
23
S
10
G
3
Posts: 545
Reputation: 4,442

Post » Thu Jul 16, 2015 11:29 pm

@matriax Yes, I put 0 to any light can become black in editor, when I run, it's still black.
B
97
S
35
G
29
Posts: 3,139
Reputation: 28,371

Post » Fri Jul 17, 2015 1:53 am

@Joannesalfa Now this have to work: https://dl.dropboxusercontent.com/u/659 ... d_v101.rar

Close C2, overwrite files , open C2 and now no matter if there is a light with 0 not appears black.

At least for me in the other version appears black in preview but in this one with lights in 0 still have ilumination if there is a light one.

Crossing fingers....
B
23
S
10
G
3
Posts: 545
Reputation: 4,442

Post » Fri Jul 17, 2015 2:09 am

@matriax ¡Felicidades!


http://i.imgur.com/e8aJRt3.png

It worked like a charm, it seems enough for production use.
B
97
S
35
G
29
Posts: 3,139
Reputation: 28,371

Post » Mon Jul 20, 2015 1:12 pm

Hi
Seems to wirk for me too. Thx!

But i still dont understand "where" is the light.
When i try your event with layertocanvasX and mouse, the light is not on the mouse.
Can you explain how it work, and what does the layer size param in the effect do?

Thx again
B
6
Posts: 25
Reputation: 300

Post » Mon Jul 20, 2015 1:32 pm

As in the comments says, you have to put in the ScreenX and ScreenY of the NormalMap effects the screen resolution of your game. 640x480, 960x540 32x240 or whatever.

If your resolution is: 960x540
Screen X = 960
Screen Y = 540

After this, the light will follow your mouse.

The light on the mouse form the example .capx not works for you?

Parameter 0 and 1 of the effect are the position of X/Y of the light that are passed using the events.

Parameter 0 (X) = (LayerToCanvasX(0, mouse.x, mouse.y))/WindowWidth
Parameter 1 (Y) = (LayerToCanvasY(0, mouse.x, mouse.y))/WindowHeight

The layerToCanvas option is because with that will works with ScrollTo too.

If you are having problems try to change Light1 in the events by this:
Parameter 0 (X) = mouse.x/WindowWidth
Parameter 1 (Y) = mouse.y/WindowHeight
B
23
S
10
G
3
Posts: 545
Reputation: 4,442

Post » Mon Jul 20, 2015 2:03 pm

Ok I'll try this.
My game will be in HD 1920x1080,
But i 'm not sure that ican preview in browser in HD,
So my screen size may not be 1920x1080.

Btw, i have the probleme on your file too, the light seems to be +150 x and -150 y
I dunno why...

I'll try few things tonight...
Thx
B
6
Posts: 25
Reputation: 300

Post » Mon Jul 20, 2015 10:19 pm

Ok... so i just found that my bug only happen in firefox.
I still dunno why, but the light is not under mouse in firefox, but seems to work great on Chrome or NW.js.

Btw, for my test I'm in 1920x1080. If I look in fullscreen mode (realHD) every thing is fine;
But if I'm in a smaller window, The rescaling blow away and the light isn't under the mouse anymore.

I'll try to create a variable with the window size and update the screenx and y resolution every tick to test...
B
6
Posts: 25
Reputation: 300

Post » Tue Jul 21, 2015 12:00 am

Seems to work
i can now rescale the chrome windows, and the light is still under the mouse cursor

Image


but still buging under firefox...


I have another problem, witch may be corrected by adding a 47 value in the shader :)
My normalmaps have an inverted Y axis. It happens, depending on the software you use to create your normalmap, in most software/engine Y axis is Up, but in construc2, Y axis is Down.
Do you think you can add a small variable like "normalmap Y axis : 0" for Down and "1" for Up, so it can automatically invert the Y axis in the shader... (I dunno in the shader how to invert green component for the normalmap rgb)
Do you think this may be possible ???

Thx
B
6
Posts: 25
Reputation: 300

PreviousNext

Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests