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 / Shader Question

Author
Message
OminusPrime
9
Years of Service
User Offline
Joined: 30th Jun 2015
Location:
Posted: 3rd May 2016 14:49
Ive been developing a shader for use with AGK2
at the moment i have a single shader that i link to all the object in my scene.
then each object has a set of textures linked to each. these textures are Color , normal , specular etc.
the textures can be different for each object and are what controls the shader allowing for all the many rendering effects..

I know i can send data to a shader but this effects all object using the same shader.
My question is can i pass data from a specific object to she shader just like with the textures but instead pass numbers.
in this way the shader can do different things for different objects.

this could be used to precalculate positions of static lights. or have features of my shader turn on or off depending on the object that is using it.

This could help especially with lighting which needs to iterate through a list of lights at runtime , i could instead pre-calculate and link in only the 1 or 2 lights that effect this one object . rendering time speed increases.
of course this is only for static lights and objects but as most geometry falls into this category.

Anyway thanks if anyone can help.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 3rd May 2016 17:28 Edited at: 3rd May 2016 17:28
What I made for my desintegration shader in my 3D Multiplayer
I used DrawObject(ObjectID) every time for every affected object...so the shader don't desintegrate all objects at the same time.
In detail I added the objects to a stack changed the shader from Normalmapping only to Desintegration+Normalmapping and ran through the list of objects which should disappear, updated the shader attributes and drew it Immediately to the current render target.

Using AGKv2 Tier1
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd May 2016 22:42
You can use SetObjectShaderConstantByName to set a shader constant for a particular object. I uploaded a shader guide recently which goes into more detail http://appgamekit.com/documentation/guides/13_shaders.htm
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 4th May 2016 17:45 Edited at: 4th May 2016 17:46
But you can not set the attribute for a specific object but for the shader which then controls the appearance of all affected objects.
I think he wants to use the same shader on several objects and control the appearance of one specific object.
I did it with changing the appearance and draw the object immediately.
(I used SetObjectShaderConstantByName anyway)

Using AGKv2 Tier1
OminusPrime
9
Years of Service
User Offline
Joined: 30th Jun 2015
Location:
Posted: 5th May 2016 16:29
Thanks Paul Johnston.
That what i'm looking for. i did read that page before but missed that functionality. great feature.


janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 5th May 2016 19:08
Oh I over Interpreted it then I guess

Using AGKv2 Tier1

Login to post a reply

Server time is: 2024-11-25 08:45:30
Your offset time is: 2024-11-25 08:45:30