Full Model Shader

Started by
9 comments, last by Ashaman73 9 years, 10 months ago

How would somebody go about creating a shader that would effect the full model ( without the need of a texture ). For example, say I wanted to create a highlight shader on a model for a bad enemy, or highlight a model when the mouse is over it? How would people normally go about doing this?

Advertisement

That's probably one of the easier shaders possible. Unfortunately, I can't write it for you since I'm not a shader writer. But I know some stuff about shaders.

Anyway, do you have a graphics programmer you can ask? Or better yet, do a google search for such a shader?

Shane, I have a graphics programmer who doesnt know how... hence asking. I dont know what to "google" search since I am not a programmer. Any tutorials you may be able to link would be ideal and very helpful.

Shane, I have a graphics programmer who doesnt know how... hence asking. I dont know what to "google" search since I am not a programmer. Any tutorials you may be able to link would be ideal and very helpful.

Ask the graphics programmer if they can set the RGB to 0.5, 0.5, 0.5.

Are you using an existing game engine?
If you are using your own game engine, are you using OpenGL or DirectX?
My current game project Platform RPG

All great questions:

1) We are using a 100% homebrew engine

2) We are using DirectX 11.1 ( so fresh so new )

What precisely are you stuck on? The question as posed is 100% trivial graphics API 101 kind of stuff, so I'm assuming there's some actually complex thing you're trying to do you should be asking about instead. You might have better luck having your graphics programmer post and respond to questions instead; I've never seen much success with having someone act as the middleman between two technical parties in an engineering discussion.

Regarding your question as posted:

Writing a shader that doesn't use a texture is as easy as writing the shader, and then not using a texture inside of it. It takes work to _add_ texture usage to a shader. Simply don't do that work and you have a shader that doesn't use a texture. The usual "shaders 101" tutorials out there will walk you through writing a shader that doesn't use a texture before they show how to add a texture.

Applying a different shader to a model is as easy as binding that shader to the context and then drawing the model. In your rendering code, before drawing a model, check which shader should be applied, apply that shader, then just draw the model like you were.

Regarding what I think your real question might actually maybe possibly be:

The hard part is deciding what you want the shader to actually do. What kind of highlight do you want? Some effects require several non-trivial effect-specific passes over the scene in order to achieve, while simpler effects require very little extra work. Here are two articles on two ways to do this (there are many more):

http://www.rastertek.com/dx11tut46.html
http://www.codeproject.com/Articles/156323/Stencil-Buffer-Glows-Part

Sean Middleditch – Game Systems Engineer – Join my team!


What precisely are you stuck on? The question as posed is 100% trivial graphics API 101 kind of stuff, so I'm assuming there's some actually complex thing you're trying to do you should be asking about instead. You might have better luck having your graphics programmer post and respond to questions instead; I've never seen much success with having someone act as the middleman between two technical parties in an engineering discussion.

If i could get him to post, i would. He seems to think "nobody will help" so I am forced to do the brunt work. I will go through the rest of your post and keep you posted, thanks!

How would somebody go about creating a shader that would effect the full model ( without the need of a texture ). For example, say I wanted to create a highlight shader on a model for a bad enemy, or highlight a model when the mouse is over it? How would people normally go about doing this?

I'm a little confused by the question, perhaps you aren't being fed good info by your graphics guy here.

Assuming you have a shader for normally rendering the object, and a different shader for rendering it highlighted, its a CPU-side decision as to which shader to use when you come to render the object - if the mouse is over the object, use shader B otherwise use shader A.

Not sure if that helps, I'm with Sean in suspecting the problem is more complex here.

Given the effects I've seen in RuinValor, I doubt switching shaders is his problem :D

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

This topic is closed to new replies.

Advertisement