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

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

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

  • matriax Yes, I put 0 to any light can become black in editor, when I run, it's still black.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • matriax ¡Felicidades!

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

    It worked like a charm, it seems enough for production use.

  • 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

  • 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

  • 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

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

  • Seems to work

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

    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

  • I don't know how to invert Y but all the programs i use have the option to invert Y or X before export. Check your program, what you use?

    Also have you tried only this:

    Every tick:

    set effect "NormalMapExtended" Parameter 0 to mouse.x/WindowWidth

    set effect "NormalMapExtended" Parameter 1 to mouse.y/WindowHeight

    Also, have you the last version of Firefox?

    Have you tried this live demo on firefox?:

    https://dl.dropboxusercontent.com/u/659 ... index.html

    The light is down the mouse? Is using the .capx demo provided, so if this live demo work on your firefox i not understand why when you compile not. In the case neither works, check if you have tha last version of firefox.

    But well, maybe in your code have something that modify any parameter that affect to the normalmaps i don't know. But also is weird that in Chrome/Nw.js works and not in Firefox.

  • Hi

    look at this capture.

    https://www.dropbox.com/s/l9qy7btzskjs6by/Capture%20d%27%C3%A9cran%202015-07-21%2013.12.03.png?dl=0

    I freshly reinstall C2 Beta r210, install your last files version, and compile your last capx, in Firefox (last release) and in Chrome.

    See what happen !

    I check the zoom in the two browser, it is at 100%. But as you see, it seems bigger in firefox than in chrome. So i wander if Firefox makes an "automatic scale" of the canvas or something, that may distrub the shader. It's not "mouse" dependant as you see, it's buged on the animated yellow square light.

    But I have the same problem with the "mouse" light (i just can't capture the mouse cursor to show you...)

    so i dunno.. really weird...

    I will just work on chrome for now.

    For the normalmap Y axis, no more problem. I made a mistake

    Thx again for your work, this shader is impressive.

    Do you think, in a future version, you can add specular (using a specular texture ?)

    Actually, I have a lots of 3D meshes with diff, spec and normal. So i can render from 3DSMax sprites in 3 versions : textured, normalmaped and speculared, and mix them in C2 with your shader.

    I made some test and it's work great with texture and normal. Just wander if I can use Specaular too.

    another question, not relative to normalmap, but do you know how I can make "selfilluminated" textures (I got many meshes using selfillum too )

    But once again, great job !!!

  • The specular light is a thing will be great to add in the future, but actually i not have the enough skill on C2/Shader to do that sorry. There is a .FX made by other user that have normalmap+specular without need another texture, get from the actual image.

    The bad thing is that seems to have some issues but i have in my queue invest some time to get the specular part and add to the normalmap .fx or made another different, will see, actually busy with my own project and working on a shaders editor.

    But you can test, use my normalmap effect adding their effect too, maybe looks a bit weird, maybe works great together, test it. Is called "Normal Mapping by GamesWarp".

    -

    About "selfilluminated" textures what is exactly the effect? only be lighted in some zones? Well they already can do that using alpha, so if you want a texture or something that only want to add ight in some zones erase them and add a sprite with alpha with only the zones that you want to have light. If i understand well from here: http://docs.unity3d.com/Manual/shader-S ... amily.html

  • Ok.

    selfilluminated maybe not the term i was looking for. It's more like Emissive. Ex a texture with some yellow points that emit light on the rest of the texture.

  • Ah i see, well, for that you can create a texture with alpha with the colors of the point and set glow or something, this will give the effect you want i guess.

    You mean this?:

    In this case you no need a "emissive texture", in 3D yes, but for 2D you can do using glow, adding an image as light or how you want to recreate the effect are you looking.

    For example i did this time ago:

    https://instagram.com/p/ntZKgiAL4C/

    Simple add an image with some glow like a shadow, add the "additive" blend and put over the graphic you want to have "emisive light" or whatever <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> .

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