[EFFECT] - GS #11 Normal Mapping

Share your Construct 2 effect files

Post » Thu Mar 06, 2014 6:09 pm

Please change what you like in the fx code and share with us something that is "ready to be used in a game". What new features would you consider adding in to make it reach that state?
=========================================
If you are on Linkedin, join other C2 professionals and network on the Scirra Construct 2 Developer Group at https://www.linkedin.com/groups?home=&gid=6732005
B
47
S
11
G
6
Posts: 193
Reputation: 7,744

Post » Thu Mar 06, 2014 6:30 pm

There is no need for this negativity. I'm only trying to help to improve this effect.
Official bumpmapping can be only used with sprites, making it impossible to use in basically any project (you can always add hundreds of objects for every tile in background, but this is obviously stupid/crazy idea)

That's why I was so excited to see someone adding different implementation of this effect, and I still am! This is lovely effect and you don't even need to add another object with normal map textures.
But like I said in previous post, to make it fully working you need to fix basically three things:
1. XY coordinates
2. Transparency in objects
3. Area/range of effect

Unfortunately I know nothing about writing fx, tried few times but it's not working with my brain.
Maybe I wasn't clear in my previous post but I pointed out these issues more like suggestions to fix not complains about "this is nice but useless".
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Fri Mar 07, 2014 12:52 am

It's always good to hear another person's suggestion though... no negativity intended. And yes, there's no requirement for a normal map, like say as a second frame in an animation. That would have been a big headache to implement. :)

Anyway, for sharing - here's a way of making things even brighter, just replace the last line of code in the fx file with this:

Code: Select all
gl_FragColor = texture2D(samplerFront, vTex) + lightintensity * vec4(c, gl_FragColor.a);


Also add in this as line 16 in the fx file:

Code: Select all
uniform float lightintensity;



Next, insert the xml file with this entry near the end:

Code: Select all
<param>
   <name>Light Intensity</name>
   <description>Use values from 1.0 to 50.0... Default value of 1.0</description>
   <type>float</type>
   <initial>1.0</initial>
   <uniform>lightintensity</uniform>
</param>


This inserts a new effect parameter known as lightintensity.
=========================================
If you are on Linkedin, join other C2 professionals and network on the Scirra Construct 2 Developer Group at https://www.linkedin.com/groups?home=&gid=6732005
B
47
S
11
G
6
Posts: 193
Reputation: 7,744

Post » Fri Mar 07, 2014 1:09 am

Another modification you can do is to make the 3D effect more pronounced. Just change these lines from this:

Code: Select all
#define OFFSET_X 1
#define OFFSET_Y 1


to this:

Code: Select all
#define OFFSET_X 2
#define OFFSET_Y 2
=========================================
If you are on Linkedin, join other C2 professionals and network on the Scirra Construct 2 Developer Group at https://www.linkedin.com/groups?home=&gid=6732005
B
47
S
11
G
6
Posts: 193
Reputation: 7,744

Post » Fri Mar 07, 2014 1:15 am

One more modification I can suggest is to make a searchlight effect emanating from the center of the screen, change the second line of code for main():

Code: Select all
vec3 ep = vec3(iResolution.x * .5, (iResolution.y) * .5, 500.);


to this new version:

Code: Select all
vec3 ep = vec3(iResolution.x * .5, (iResolution.y) * .5, 100.);
=========================================
If you are on Linkedin, join other C2 professionals and network on the Scirra Construct 2 Developer Group at https://www.linkedin.com/groups?home=&gid=6732005
B
47
S
11
G
6
Posts: 193
Reputation: 7,744

Post » Fri Mar 07, 2014 1:24 am

Finally to add a blurring effect a few pixels behind, change line 5 of main() from this:

Code: Select all
vec3 c = sample(0, 0) * dot(n, normalize(lp - sp));


to this:

Code: Select all
vec3 c = sample(0, 5) * dot(n, normalize(lp - sp));


Come to think it, to make a cel shading like effect, change the same line to something like this:

Code: Select all
vec3 c = normalize(sample(0, 4) * dot(n, normalize(lp - sp)) + sample(0, 5) * dot(n, normalize(lp - sp)));
=========================================
If you are on Linkedin, join other C2 professionals and network on the Scirra Construct 2 Developer Group at https://www.linkedin.com/groups?home=&gid=6732005
B
47
S
11
G
6
Posts: 193
Reputation: 7,744

Post » Sun Jan 17, 2016 2:48 pm

@necromaster

Where i can download this effect??
B
36
S
13
G
2
Posts: 200
Reputation: 3,868

Post » Fri Jan 22, 2016 2:57 am

=========================================
If you are on Linkedin, join other C2 professionals and network on the Scirra Construct 2 Developer Group at https://www.linkedin.com/groups?home=&gid=6732005
B
47
S
11
G
6
Posts: 193
Reputation: 7,744

Post » Sun Jan 24, 2016 1:04 pm

@necromaster

thank you!
B
36
S
13
G
2
Posts: 200
Reputation: 3,868

Previous

Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests