CaptainCrazy Posted September 8, 2013 Share Posted September 8, 2013 I don't really ask for help much here but oh well. I'd like to be able to make shiny parts for some stuff I'm working on, i know how to make them in 3DS Max but is there something like an alpha that the engine needs to read in order to acknowledge it? I've tried looking for tutorials on this particular thing but no luck as of yet, i've even tried going through a few textures that i know use "shiny" parts on them but they just seem to be simple .JPG and i wasn't aware that .JPG used alpha channels. So i guess that it has something to do with the shader itself but, as i said, i can't find any tutorials on it xD I noticed that some models come with 2 or 3 textures, one that says _spec and one that says _glow. Obviously self explanatory but i don't get how a simple .JPG can have such an effect in the engine. I'll continue to look through textures and shader files until somebody can explain it to me or provide a tutorial. Link to comment
AshuraDX Posted September 8, 2013 Share Posted September 8, 2013 it's all in the shader files , I'll document one or two of my files for you Edit : there you go , If you need further help let me know models/weapons2/illrian2/w_saber <- target texture path , it doesnt have to exist as an image but your model has to load this texture for the shader to have an effect { q3map_nolightmap { map models/weapons2/illrian2/w_saber <- texture path for the first stage blendFunc GL_ONE GL_ZERO <-default blendfunc , no Transparency rgbGen lightingDiffuse <- makes this stage the diffuse stage of you shader , in 3ds max this would be your diffuse/color map } { map textures/common/env <- texture path for the second stage blendFunc GL_DST_COLOR GL_SRC_COLOR <- blendfunc that works similiar to the "Overlay" blendmode in photoshop detail <- prevents this stage from being rendered from far distance alphaGen const 0.5 <- I think you can guess what this does , if you dont this sets the stages opacity to 50% (I use this to tweak the intensity of the shine) tcGen environment <- This makes the stage an Environment map , which is exactly what you asked for } { map models/weapons2/illrian2/w_noshine blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA <- Soft-Edged alpha default blendfunc , this stage overlays parts of my now glossy Texture to cover the gloss effect in some places rgbGen lightingDiffuse } { map models/weapons2/illrian2/w_spec blendFunc GL_SRC_ALPHA GL_ONE <- I cant tell you more about this than that this blendfunc is usually used for Specularity stages , I havnt experimented with changing this detail alphaGen lightingSpecular <- only draws this stage when the surface is lit bright enough , (makes it a specular map) } } I got one more for ya models/weapons2/w_starkiller/red { q3map_nolightmap cull disable { map models/weapons2/w_starkiller/diffuse alphaFunc GE128 <- Hard edged alpha , above 50% opacity will be opague and everything below will be fully transparent blendFunc GL_ONE GL_ZERO rgbGen lightingDiffuse } { map models/weapons2/w_starkiller/cr blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen lightingDiffuse } { map models/weapons2/w_starkiller/specular blendFunc GL_SRC_ALPHA GL_ONE detail alphaGen lightingSpecular } { map models/weapons2/w_starkiller/ir blendFunc GL_ONE GL_ONE <-this blendfunc gives you alpha depending on the brightness of your texture map , white = 100% visible , black = 0% visible detail glow <-this enables dynamic glow } } Link to comment
CaptainCrazy Posted September 8, 2013 Author Share Posted September 8, 2013 it's all in the shader files , I'll document one or two of my files for you Edit : there you go , If you need further help let me know models/weapons2/illrian2/w_saber <- target texture path , it doesnt have to exist as an image but your model has to load this texture for the shader to have an effect { q3map_nolightmap { map models/weapons2/illrian2/w_saber <- texture path for the first stage blendFunc GL_ONE GL_ZERO <-default blendfunc , no Transparency rgbGen lightingDiffuse <- makes this stage the diffuse stage of you shader , in 3ds max this would be your diffuse/color map } { map textures/common/env <- texture path for the second stage blendFunc GL_DST_COLOR GL_SRC_COLOR <- blendfunc that works similiar to the "Overlay" blendmode in photoshop detail <- prevents this stage from being rendered from far distance alphaGen const 0.5 <- I think you can guess what this does , if you dont this sets the stages opacity to 50% (I use this to tweak the intensity of the shine) tcGen environment <- This makes the stage an Environment map , which is exactly what you asked for } { map models/weapons2/illrian2/w_noshine blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA <- Soft-Edged alpha default blendfunc , this stage overlays parts of my now glossy Texture to cover the gloss effect in some places rgbGen lightingDiffuse } { map models/weapons2/illrian2/w_spec blendFunc GL_SRC_ALPHA GL_ONE <- I cant tell you more about this than that this blendfunc is usually used for Specularity stages , I havnt experimented with changing this detail alphaGen lightingSpecular <- only draws this stage when the surface is lit bright enough , (makes it a specular map) } } I got one more for ya models/weapons2/w_starkiller/red { q3map_nolightmap cull disable { map models/weapons2/w_starkiller/diffuse alphaFunc GE128 <- Hard edged alpha , above 50% opacity will be opague and everything below will be fully transparent blendFunc GL_ONE GL_ZERO rgbGen lightingDiffuse } { map models/weapons2/w_starkiller/cr blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen lightingDiffuse } { map models/weapons2/w_starkiller/specular blendFunc GL_SRC_ALPHA GL_ONE detail alphaGen lightingSpecular } { map models/weapons2/w_starkiller/ir blendFunc GL_ONE GL_ONE <-this blendfunc gives you alpha depending on the brightness of your texture map , white = 100% visible , black = 0% visible detail glow <-this enables dynamic glow } } So using this as a basis how much needs to be changed apart from file names obviously? I just want to mess around with it but i bloody hate scripting lol. Link to comment
AshuraDX Posted September 8, 2013 Share Posted September 8, 2013 @@CaptainCrazy nothing , reallyjust the file names and you mgiht want to play around with the alphaGen const value for your env map Link to comment
CaptainCrazy Posted September 8, 2013 Author Share Posted September 8, 2013 @AshuraDX How come a lot of sabers have a _spec.jpg? I guess making something like this for an env map will do for now: And the alphaGen const changes how much influence it has on the texture. I would like to make specular to give the illusion of weathering on shiny parts but not sure if that's possible. Link to comment
AshuraDX Posted September 8, 2013 Share Posted September 8, 2013 might look good , might not you'll have to try that but all texture must be power of 2 size Link to comment
Circa Posted September 8, 2013 Share Posted September 8, 2013 @AshuraDX How come a lot of sabers have a _spec.jpg?That's what it uses for the specular shadow effect. When you're in the dark part of a map and not in the light, it will use whatever spec.jpg you assign it. Link to comment
CaptainCrazy Posted September 8, 2013 Author Share Posted September 8, 2013 might look good , might not you'll have to try that but all texture must be power of 2 size I know textures need to be power of two xD Link to comment
AshuraDX Posted September 11, 2013 Share Posted September 11, 2013 That's what it uses for the specular shadow effect. When you're in the dark part of a map and not in the light, it will use whatever spec.jpg you assign it.wrongthe specular texture is the texture that blends in when a surface on the model is lit strong enough Link to comment
Tempust85 Posted September 11, 2013 Share Posted September 11, 2013 I was messing around in shaderEd for my Stormtrooper, and I was able to have specular & gloss on the armor. The spec worked as it normally does and made the gloss become less visible the darker the spec was in certain areas. I think it came out pretty well. If you want the shader code, I'll post it but I think AshuraDX has it covered. Link to comment
ChalklYne Posted September 11, 2013 Share Posted September 11, 2013 and how about masking off env stages? Link to comment
AshuraDX Posted September 11, 2013 Share Posted September 11, 2013 and how about masking off env stages? you can use either Overlays or another method Szico has shown me , which I havn't really used yetI'll dig up the shader for ya , this was supposed for a puddle one of the barrels I made for szico should leave in the map but somehow the decal effect didnt show up , while the shader itself worked fine when applied to a patchmesh in GTK gfx/moonbase_labs/puddle_decal { qer_editorimage gfx/moonbase_labs/puddle surfaceparm trans polygonOffset q3map_nolightmap { map gfx/moonbase_labs/puddle alphaFunc GE128 depthWrite } { map gfx/moonbase_labs/puddle_env blendFunc GL_SRC_ALPHA GL_ONE depthFunc equal glow tcGen environment } } Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now