MiMoriarty wrote:CaptSolo wrote:
The important bit about shaders are:
1) Declaring the textures in the order wanted by the fragment shader
2) Creating the effects map with the correct RGB values
Study Griff's rocket shader example and his other OXP textures and you'll get the hang of it.
Okay...........what?
I've had a hard time with Griff examples and still i can't figure how to make them work. I have also tried to use a griff's Python
shipdata.plist with my own models faking the textures and it still didn't work. I'm bewildered.
Maybe it has something to do with the 3D model itself. Should it be normal mapped for the shaders to work?... I don't understand the fragment vertex code because I'm not programer and this's my real problem.
1) It has nothing to do with the 3D model
2) You don't need to bother with Griff's shader code and don't need to be a programmer.
3) It all hinges on how you make the effects map to get the glows from engine use, laser use and heated metal effect
As I understand it, the fragment shader reads the color channels from the effects texture to create glowing effects. The parts that are red are for the engines and produce a cyan glow, those that are green for the laser and produce a orange to red glow, and those that are blue for parts of your ship that glow because they are heated by the exhaust. Looking at Griff's Rocket Shader example in Shaders Outpost you can see parts of the fins glowing red because of contact with the exhaust plume.
The big question now is, "How in hell do I do that"? I can tell you briefly how I did it but Griff (and others) may have a better technique. All of my more recent models had engine nozzles, parts that stuck out the back from the engines, and laser cannons that protruded from the front and back. There's a funny story here about the lasers but will get to that later.
1) Open your diffuse texture in GIMP or whatever you use and save it to your Textures folder with a new filename (e.g. myship_effects.png)
2) Select the parts you want glowing effects, The engines, nozzles, and laser cannons if you have them. I use whatever selection tool is required but the important part is to set the selection mode to "ADD".
3) Once all parts selected, INVERSE the selection. This is important.
4) Set your foreground color to black (#000000).
5) Use the paint bucket tool or fill tool, set it to fill the entire selection, and fill to black.
Hard part done. Now all that remains are the parts you want glowing effects for. That is why we selected them and then inversed the selection so that only those parts remained. Now all you have to do is what GIMP calls, "Colorize".
1) Select the engines, similar to step 2 above. I like to use the Free Select tool and draw around the engines.
2) To eliminate the black I use what GIMP calls Fuzzy Select (or magic wand), set the threshold to zero and mode to subtract. Click on a black area to reduce the selection to just the engines.
3) Choose the colorize tool or whatever it's called in your graphics program. In GIMP it is under the colors menu.
4) Set the Hue to zero (red) and Saturation to maximum (100%). It is advisable to decrease the Lightness value but that depends on it's original values. Click OK to finish.
Repeat these steps for the laser and engine nozzles except for colorizing use these values:
Green: Hue=120
Blue: Hue=240
Like I said you may need to darken each area somewhat and save the finished texture. And if you want the shader files that I have used successfully just drop me a PM.
Griff likes to use a green gradient for his lasers and this is a good spot to tell you my story. I always wondered why Griff used subentities for his lasers and then one day I discovered why. I took my ship out for a test run and fired the forward laser. Yup, it works, as the laser went from grey to orange and finally red. Then I happened to be looking at the external view and noticed my aft laser was glowing as well but I had never fired it.