Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 3D shader normal & spec map - help needed

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 1st Jun 2016 20:26
Hi

I would like to create a simple normal map & spec map shader, but I don't know how to do (as simple as possible).
can anyone help me ?

Here is my code :



The shader.ps :


The shader.vs :


If you need the images, tell me

Thank you very much for your help.

AGK2 tier1 - http://www.dracaena-studio.com
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 3rd Jun 2016 09:31 Edited at: 3rd Jun 2016 09:31
This is actually a really good point.
How can we affect specular and normals by the given lighting functions from AppGameKit? We need at least the direction of the lights, or am I wrong?
+1 for a soultion on this problem

[/url]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jun 2016 01:24
Can you post the zipped project?
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 4th Jun 2016 07:43
@blinkOk : Here is the zipped project (with texture and shader which doesn't work ^^).

http://blendman.free.fr/dev/agk/3D_normalspecmap.zip
AGK2 tier1 - http://www.dracaena-studio.com
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 5th Jun 2016 17:04 Edited at: 5th Jun 2016 17:06
Hi,

For the Normal-mapping you can pass the Normal as a parameter in GetPSLighting if you have the perturbed Normal.
The only advantage I can see with GetPSLighting is you don't need to pass light position or color manually.
But for the specular effects you will need the light position, so you must pass it anyways...

Using AGKv2 Tier1
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 5th Jun 2016 17:31
Quote: " But for the specular effects you will need the light position, so you must pass it anyways..."

So, Paul has to build a custom specular calculation function like the light or fog function, or we do have to pass the agk lights manually.
At least a function where we can get the positions of the AppGameKit lights....

Hmm... actually we can build it:
1. Create an array in AppGameKit for all lights
2. Check distance to camera in real time and sort the array after distance
3. Get the 8(?) nearest lights and create an array for them, save position in it
4. Pass array to shader via command
5. Use them for specular calculations


1 - 4 can be replaced, once the correct shader function set is made.

I would definitly prefer the build in function for specular, but we would also need at least a function, where we can get all the data from the AppGameKit lights like color, position, maybe angle anyway.

[/url]
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 5th Jun 2016 18:52
The build in functions look nicer in the code but I would not do both.. pass the light positions as an array and use the GetPSLighting in the shader.

And for me CreatePointLight doesn't return a Value (the LightID)... I call this a bug.

Using AGKv2 Tier1
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 5th Jun 2016 23:49
Quote: "I would not do both.. pass the light positions as an array and use the GetPSLighting in the shader."

I think this is the best practical method so far, it should be easy to implement and be quite fast or am I wrong?

[/url]
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 6th Jun 2016 14:53
Sorry, the accentuation is on the and
I would either use the arrays and calculate everything myself or
use the GetPSLighting and wait for something to get the light positions from the build in AppGameKit commands.
It just would be redundant to have arrays and that GetPSLighting function thing as it also needs the light positions.

Using AGKv2 Tier1

Login to post a reply

Server time is: 2024-09-29 15:25:15
Your offset time is: 2024-09-29 15:25:15