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

1 favourites
From the Asset Store
A template which allows you to customise the controls of your game.
  • The normal map effect is based on this:

    https://github.com/mattdesl/lwjgl-basic ... derLesson6

    Screenshot:

    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:

    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:

  • #shiny

  • LOL !

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

    Thx !!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • arg, need r209

  • 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! <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    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.

  • 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...

  • 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

  • yeah sure <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> 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

  • so i need to define my torch 3D position, and my light target (mouse) 3D position, and rasterise it in 2D.

  • Wow, thanks! Just what I needed:D

  • matriax

    a nice tuto on glsl light shader, might be interesting (i was looking for the spotlight ^-^)

    But no idea how to make it in C2 by now...

    Like you, i'm really not experienced in shader

    http://www.tomdalling.com/blog/modern-opengl/08-even-more-lighting-directional-lights-spotlights-multiple-lights/

    and a second tuto :

    http://www.ozone3d.net/tutorials/glsl_lighting_phong_p3.php

  • they are interesting but as you said seems complicated, maybe an expert can do all that, but i will give a try this weekend when i finish other things just for fun .

  • matriax complicated, maybe an expert can do all that. Wrong anyone can do it if they want to learn. Young peron like you should not give up that easy matriax

  • Lordshiva1948 Come on! .

    Already there is a lot people that in some time learned shaders or they actually work with that and can do in short time.

    For example, discover how apply the alpha in NormalMaps took me 2 days, and the solution was simply add "* front.a" at the end of the shader output ¿You think spend 2 days for that is give up easy?. An expert or somebody that already release effects and works with that can discovered/did it in seconds. If this took me two days imagine apply all this things of the tutorial, at the end i not will work nothing in the game.

    And for end, as i said: "i will give a try this weekend when i finish other things". BTW, for my game i not need this last things, with the actual NormalMaps effects i have just i need now, for that, apply all in this tutorial with spotlights,etc... maybe an expert with time can do that but with my skills on C2(I started a few days ago) and shaders, well , apologize me if i actually prefer invest the most part working in the game.

  • AS you wish I did not meant to waste your time. If you think I did than so sorry

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)