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.

DarkBASIC Professional Discussion / Can I apply shader to only one particular region or regions of an object mesh

Author
Message
Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 5th Apr 2012 13:38
Hello,

Suppose I have downloaded a shader file from the internet. Now can I apply that shader effect to a particular region or regions of an object or mesh and not the whole surface of the object / mesh ?

The second question is question can I do the above stated thing while using textures ?

If so, how ?

Thanks,
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Apr 2012 13:42
Use objects with limbs and set limb effect.

You have texture limb as well.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Apr 2012 14:48 Edited at: 5th Apr 2012 14:48
@ GG

Is there a way to do it if the model is bone-rigged and limbs share the same mesh? An example of such a model would be an export from CharacterFX.

TheComet

Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 5th Apr 2012 15:38 Edited at: 5th Apr 2012 15:40
If you are trying to apply shaders to specific parts of the same mesh then you will need to add this into the shader. Generally you would add an additional texture stage that would be a grayscale map of where to apply the shader. For instance, if you had a character who was wearing armour and wanted just the armour to have a reflection then you would create a new texture where the whole character was black apart from the armour which would be white and then use this as a look-up in the shader to know where to apply the effect. I'm sure Green Gandalf being the shader master he is will be able to better explain / expand on this though. However, if there is no sign of an example by the time I get to my home PC I'll try and get a demo together for you.

[Edit]Typo![/Edit]


Previously TEH_CODERER.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 5th Apr 2012 17:20
wooo I have been asking this question for ages...

Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 5th Apr 2012 19:16
Quote: "If you are trying to apply shaders to specific parts of the same mesh then you will need to add this into the shader. Generally you would add an additional texture stage that would be a grayscale map of where to apply the shader. For instance, if you had a character who was wearing armour and wanted just the armour to have a reflection then you would create a new texture where the whole character was black apart from the armour which would be white and then use this as a look-up in the shader to know where to apply the effect. I'm sure Green Gandalf being the shader master he is will be able to better explain / expand on this though. However, if there is no sign of an example by the time I get to my home PC I'll try and get a demo together for you."

-You sound like a real professional in game industry.

Mr.Valentine ,do you know the detailed steps to create such a shader ?

Meanwhile I will wait for Andrew to show us something ....
James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 5th Apr 2012 19:21 Edited at: 5th Apr 2012 19:29
Exactly as GG and mr Neale have stated, dependin on how experienced you are there is this;
http://www.evolved-software.com/materialeditor/materialeditor
Edit : oops wrong one - thought his material editor was the blend map demo he did lol - sorry
if you goto advanced lighting under code snippets on same site and download that then you will see example of blend map(see image)

Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 5th Apr 2012 20:07
@James H: Just great ..... just what I wanted to see ...
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 8th Apr 2012 12:18
@Juggernaut - Thanks. I've been building games since 2002 now, on and off, but it is unfortunately still just a hobby at the moment and, whilst I have progressed a lot, I know I still have much to learn. Sorry I've taken so long to reply but I have been staying at my parents' house for awhile with no PC access. It looks like a good example has already been provided though so just let me know if there is any more help I can provide.


Previously TEH_CODERER.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Apr 2012 13:53
Quote: "but I have been staying at my parents' house for awhile with no PC access."


Good grief! Upgrade your parents!
Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 8th Apr 2012 16:04
@Andrew_Neale: Thank you for reverting back . I am currently trying to learn shaders from ground up.

Another series of questions on shader -

Can shaders be applied to the screen itself ( not the objects in the screen ) ?

Secondly applying different shaders to different portion of a screen - possible or not ?

Thirdly - can I pass data - variable values / textures etc. at run - time from the Dark Basic Pro code to the shader or in other words can the loaded and shader be manipulated at run - time from within
Dark Basic Pro code ?

Thanks,
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 8th Apr 2012 21:26
@Green Gandalf - Haha, sadly my mother swears by Macs.

@Juggernaut - You'll be looking at the following commands for screen based effects.



I can't remember when these effects came about, but if you're up to date with DarkBASIC Pro releases then they should be available.

Textures can either be supplied by the shader or the shader can use the textures already applied to the object or screen it is running on. You can also supply / update variables within the shader. If you look through the examples on Evolved's site then you should see examples of both. If it is not clear after a look over then I'm sure I can get a more commented example together.


Previously TEH_CODERER.
Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 8th Apr 2012 21:33
@Andrew_Neale: Thank you Andrew for your comments and advice. I guess I will have to throughly go through the Evolve's examples to get to know more about shaders. Anyway, thank you again for your time ...
Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 11th Apr 2012 00:51
So, can we conclude that shaders work on or affect the texture of the mesh/3D object/model rather than the model/mesh itself ... ?
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 11th Apr 2012 01:00
Quote: "So, can we conclude that shaders work on or affect the texture of the mesh/3D object/model rather than the model/mesh itself ... ? "

yes, that's exactly what shaders do (at least the ones in dx9)

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 11th Apr 2012 01:21
eh? maybe I read that wrong or misunderstood what is being asked but pixel shaders work on the textures, vertex shaders work on the vertices(mesh), fx shaders do both
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Apr 2012 02:02
James H, you read my thoughts.
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 11th Apr 2012 02:50
Quote: "eh? maybe I read that wrong or misunderstood what is being asked but pixel shaders work on the textures"

you are correct

Juggernaut
14
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 11th Apr 2012 11:49
ok, understood ......

Login to post a reply

Server time is: 2026-07-09 20:55:44
Your offset time is: 2026-07-09 20:55:44