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

Share your Construct 2 effect files

Post » Thu Jul 09, 2015 8:59 pm

The normal map effect is based on this:
https://github.com/mattdesl/lwjgl-basic ... derLesson6

Screenshot:
Image

The effect was first ported to C2 by @donelwero that posted in some lost thread i found the other day. After see various NormalMaps effects this was the best(IMHO), so for my game i decide to use and edit without any experience about shaders to adapt to my needs.

As i said @donelwero made the hard work making the .fx and .xml file port. My work was pass from the original 5 variables to 16, i passed all that i saw in the .fx to be adjusted easily from C2, here is how actually looks:
Image

Also i corrected how the X/Y light was applied in the .capx file(And works with scroll to) and today finally discovered how edit the .fx file to use normal maps with alpha channel, after two days was simply adding at the output of all the effect a "* front.a" , still i don't know why, as i said i not have idea of shader i simply passed 2 days changing variables to get the effect desired XD .

-

Edit 1 - 13 July:
Normal Map Extended v1.01 (Multiple lights added)


*Added multiple lights(in total 3) with all their variables an with the option to enable/disable from an individual texture.

Download v1.01 (Includes the effect and demo .capx)
https://drive.google.com/file/d/0B8vm3F ... sp=sharing


Screenshot:
Image
Last edited by matriax on Sun Mar 19, 2017 1:57 pm, edited 14 times in total.
B
23
S
10
G
3
Posts: 545
Reputation: 4,442

Post » Thu Jul 09, 2015 9:39 pm

#shiny
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Thu Jul 09, 2015 11:12 pm

LOL !
I spend all the day to try to make the exact same shader based on the same site !

Thx !!
B
6
Posts: 25
Reputation: 300

Post » Thu Jul 09, 2015 11:30 pm

arg, need r209 :)
B
6
Posts: 25
Reputation: 300

Post » Fri Jul 10, 2015 7:17 am

Added the live example to see how works in real time:
https://dl.dropboxusercontent.com/u/659 ... index.html

-

I want to optimize the code and i need help.

Before add multiple lights or more things i want to reduce the number of variables for each light using only one box instead various, What i mean? For example for the light color and the ambient i use 6 boxes for R,G,B. The idea is reduce to 2 using something like: "RGB: 255,255,255". If somebody knows how to do that please feel free to edit the .fx and upload! ;)

Other thing is the "Screen X/Y resolution" that you need to adjust to your window project. There is any way to add some variable in the .fx that get the window screen automatically?

With this two things go from 8 to 2 variables with a total of 10 for each light when i discover how to add more.
B
23
S
10
G
3
Posts: 545
Reputation: 4,442

Post » Fri Jul 10, 2015 9:56 am

@matriax

for the screen, my idea was to create an event to set every tick the 2 effect parameters to screenX & Y resolution to WindowWidth and WindowHeight, that should also ajust the effect if you modify the browser windows size.
(i'll try this...)

for the other param, i search for the same thing (color picker, vector, etc...) instead of "float" or "percent", but didn't find anything... I don't know what other param type can be created in the xml file...
Maybe the solution is to use a "text" field, and parse the text to create vector or other... I don't know if this could work...

Last point, i wander why you didn't create variable for the lightdir ? cause i need it.
I'll try to add this to your shader...
B
6
Posts: 25
Reputation: 300

Post » Fri Jul 10, 2015 10:07 am

Instead every tick, with a simple "On start layout" set this parametres to the windows height/width sizes will be ok, but again you will need an event. The idea is put on the .fx to get it automatically without needs of nothing ;) .

I see "LightDir" inside the .fx but this is calculated automatically depending in where is the player respect the objects with normal maps. You set the LightDir to the point you want in the .capx in my case on the Mouse.X and Mouse.Y. I not understand in which way you want to use that variable ¿? .

If you do will be good to see an example of the difference and the improvement ;)
B
23
S
10
G
3
Posts: 545
Reputation: 4,442

Post » Fri Jul 10, 2015 10:37 am

yeah sure :) i'll put some files when i'll have something interesting.

Actually I try to make a 2D plateformer, but with 3D lighting.
basically the player have a torchlight, and can light the background with the mouse.

So i need to simulate/fake a Z axis to modify the lightdir, Z, falloff, intensity, etc... to fake the 3D lighting deformation.

something like this :
https://www.dropbox.com/s/ucqrl6fyo3y7kq5/test.png?dl=0
B
6
Posts: 25
Reputation: 300

Post » Fri Jul 10, 2015 10:55 am

so i need to define my torch 3D position, and my light target (mouse) 3D position, and rasterise it in 2D.
B
6
Posts: 25
Reputation: 300

Post » Fri Jul 10, 2015 2:37 pm

Wow, thanks! Just what I needed:D
B
34
S
15
G
6
Posts: 244
Reputation: 4,372

Next

Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests