Quake3World.com https://www.quake3world.com/forum/ |
|
broken glass shader [solved] https://www.quake3world.com/forum/viewtopic.php?f=10&t=51000 |
Page 1 of 1 |
Author: | Pat Howard [ 04-19-2015 07:46 PM ] |
Post subject: | broken glass shader [solved] |
hey guys, shader noob question here. i've been trying to figure this out but i can't find a specific example of this having been done before (or maybe i'm just not thinking creatively enough). i'm trying to make a broken glass shader. i'd like the glass to be translucent, as in blendfunc filter, with an env map, but i also want to have an alpha channel where the hole in the glass is. could someone help me modify this shader to include an alpha channel? Code: textures/phdm5/glass_break1 { qer_editorimage textures/phdm5/glass_break1.tga qer_trans 0.9 surfaceparm nolightmap surfaceparm nodlight surfaceparm trans { map textures/phdm5/glass_break1.tga blendfunc filter } { map textures/phdm5/glass_env.tga blendfunc add rgbGen identity tcGen environment } } as it stands, the alpha channel is not showing up in game. i tried blendfunc blend and that got the alpha channel working, but i also lost the translucency of the glass. i also tried just using grey in the alpha channel for the glass and black in the alpha channel for the hole with blendfunc blend, but then the texture appeared overly bright compared to blendfunc filter. any help appreciated. thanks, pat |
Author: | AndehX [ 04-20-2015 03:36 AM ] |
Post subject: | Re: broken glass shader |
I was going to say, as long as the alpha channel has grey for the glass and black for the hole, it should work theoretically. If it's appearing too bright in game, then try adding "rgbGen lightingDiffuse" under blendfunc blend and if its still too bright, try changing glass_env to "rgbGen lightingDiffuse" aswell |
Author: | sst13 [ 04-20-2015 02:08 PM ] |
Post subject: | Re: broken glass shader |
Code: textures/phdm5/glass_break1 { qer_editorimage textures/phdm5/glass_break1.tga qer_trans 0.9 surfaceparm nolightmap surfaceparm nodlight surfaceparm nomarks surfaceparm trans cull disable { map textures/phdm5/glass_break1.tga blendfunc filter rgbGen identity depthWrite alphaFunc GE128 } { map textures/phdm5/glass_env.tga blendfunc add rgbGen identity tcGen environment depthFunc equal } } Or with a lightmap: (dark areas reflect more...) Code: textures/phdm5/glass_break1
{ qer_editorimage textures/phdm5/glass_break1.tga qer_trans 0.9 surfaceparm nodlight surfaceparm nomarks surfaceparm trans cull disable { map textures/phdm5/glass_break1.tga blendfunc filter rgbGen identity depthWrite alphaFunc GE128 } { map $lightmap blendfunc filter rgbGen identity tcGen lightmap depthFunc equal } { map textures/phdm5/glass_env.tga blendfunc add rgbGen identity tcGen environment depthFunc equal } } |
Author: | Pat Howard [ 04-20-2015 04:13 PM ] |
Post subject: | Re: broken glass shader |
@sst13: thanks, but those shaders made the glass too dark. i'd like to have an alpha on the broken glass but still have it look similar to the surrounding unbroken glass. maybe it's not possible without using a grey alpha? i could do it this way but it seems a bit like a hack and it would take a bit of fiddling to get it to look like a standard blendfunc filter. here are the textures i am using: glass_break1.tga glass_env.jpg glass.jpg |
Author: | Fjoggs [ 04-20-2015 05:07 PM ] |
Post subject: | Re: broken glass shader |
Instead of faking it, why not simply break the glass instead? |
Author: | sst13 [ 04-20-2015 06:49 PM ] |
Post subject: | Re: broken glass shader |
Note: Both of my test shaders got the same name. You maybe used the lightmapped one accidentally... So if this is your glass shader: Code: textures/phdm5/glass { qer_editorimage textures/phdm5/glass.tga qer_trans 0.9 surfaceparm nolightmap surfaceparm nodlight surfaceparm trans { map textures/phdm5/glass.tga blendfunc filter rgbGen identity } { map textures/phdm5/glass_env.tga blendfunc add rgbGen identity tcGen environment } } This should be the matching "broken" one: Code: textures/phdm5/glass_break1
{ qer_editorimage textures/phdm5/glass_break1.tga qer_trans 0.9 surfaceparm nolightmap surfaceparm nodlight surfaceparm trans { map textures/phdm5/glass_break1.tga blendfunc filter rgbGen identity depthWrite alphaFunc GE128 } { map textures/phdm5/glass_env.tga blendfunc add rgbGen identity tcGen environment depthFunc equal } } |
Author: | Pat Howard [ 04-20-2015 09:01 PM ] |
Post subject: | Re: broken glass shader |
@sst13: thanks for your help again. both shaders appear darker like that. do you have a different result on your end? @fjoggs: i could, but i thought the shapes would be more interesting and realistic this way. |
Author: | cityy [ 04-21-2015 01:08 PM ] |
Post subject: | Re: broken glass shader |
Pat Howard wrote: @fjoggs: i could, but i thought the shapes would be more interesting and realistic this way. It's also good from a tris count point of view. Though I don't know how much alpha channel shaders hit - in terms of performance, compared to say 100 more polygons. |
Author: | sst13 [ 04-21-2015 02:05 PM ] |
Post subject: | Re: broken glass shader |
Pat Howard wrote: @sst13: thanks for your help again. both shaders appear darker like that. do you have a different result on your end?. Looks pretty much ok on my end: Pat, can you post your (unbroken) glass shader? cityy wrote: Though I don't know how much alpha channel shaders hit - in terms of performance, compared to say 100 more polygons. It depends on how much you can see through the alpha tested texture. In this case (only the skybox) it wouldn't eat up much performance. A bad idea would be to view bigger parts of the map through such a shader. (using this PC) |
Author: | Pat Howard [ 04-21-2015 08:23 PM ] |
Post subject: | Re: broken glass shader |
sst13 wrote: Looks pretty much ok on my end yeah, that is exactly what i'm after. i'm using the both the shaders you posted, the unbroken and the matching broken one. |
Author: | AndyW [ 04-22-2015 12:27 AM ] |
Post subject: | Re: broken glass shader |
Intresting Post! Seems the Crack in Pats "Glass" goes up to the right - and in ssts "glass" it moves up to the left. Maybe it make a difference which side oft the brush you put the texture on? In the 2 shots they display different/ mirrored. Was just an idea |
Author: | Fjoggs [ 04-22-2015 01:16 PM ] |
Post subject: | Re: broken glass shader |
cityy wrote: Pat Howard wrote: @fjoggs: i could, but i thought the shapes would be more interesting and realistic this way. It's also good from a tris count point of view. Though I don't know how much alpha channel shaders hit - in terms of performance, compared to say 100 more polygons. Yeah those 100 extra tris sure add up huh? |
Author: | AndyW [ 04-22-2015 04:37 PM ] |
Post subject: | Re: broken glass shader |
I also think its better to get the Shader to work well, brushing out broken glass is soo Q2-style |
Author: | cityy [ 04-23-2015 09:44 AM ] |
Post subject: | Re: broken glass shader |
Fjoggs wrote: Yeah those 100 extra tris sure add up huh? Well, yea, in this particular case it is not very relevant but I think it's a good thing to be aware of the effect your decisions have on the polycount every time you make one. It's something I like to ignore a lot. |
Author: | Fjoggs [ 04-23-2015 01:17 PM ] |
Post subject: | Re: broken glass shader |
Shaders affect performance as well. The triscount from a broken glass like that would be as negligible on performance as the shader would be. |
Author: | Pat Howard [ 04-23-2015 08:28 PM ] |
Post subject: | Re: broken glass shader |
@sst13: okay, i just realized what the problem is. it's actually the skybox behind the glass that is causing my problem! the broken glass shader only appears darker when viewing the skybox through it. the skybox is not visible at all and it also creates a very weird HOM effect that you can't quite see from the picture. here is my sky shader, copied from the shader manual: Code: textures/kara/hip_miramar { skyparms env/hip_miramar/miramar - - q3map_sunExt 1 1 .93 450 323 70.5 3 32 q3map_lightmapFilterRadius 0 8 q3map_skyLight 125 6 surfaceparm sky surfaceparm noimpact surfaceparm nolightmap surfaceparm nodlight nopicmip nomipmaps qer_editorimage env/hip_miramar/miramar_ft.tga } anyone know what causes this? |
Author: | CZghost [ 04-24-2015 06:40 AM ] |
Post subject: | Re: broken glass shader |
Detail the brush with glass shader? You said it's causing little HOM effect - blocking vis - repair with detail brush... I'm not sure if Radiant support also making brush nonsolid, which might make brush detail and compiler should not generate collision polygons for it... This could also help. If you use caulk for invisible faces, don't, use nodraw instead... Also nopicmip and nomipmaps should not be in one shader... And I never seen sky shader with these options... |
Author: | Pat Howard [ 04-24-2015 09:53 AM ] |
Post subject: | Re: broken glass shader |
@czghost: i appreciate your desire to help on the forum, but none of the stuff you just said is true. it's no good to have that kind of false information floating around here. in the future, could you do me a favor and please only comment on technical topics when you have a strong knowledge of the subject? @sst13: would you mind just trying the shader in front of a skybox? i'm getting this problem with any kind of skybox shader i try, but not with stock q3 skies. |
Author: | AndyW [ 04-24-2015 11:18 AM ] |
Post subject: | Re: broken glass shader |
Hmm.. Hard Words! So i wont post any Ideas too cause im a Noob... I hope you will figure it out! |
Author: | sst13 [ 04-24-2015 02:34 PM ] |
Post subject: | Re: broken glass shader |
Adding a higher sort value solves the problem with the skybox: Code: textures/phdm5/glass_break1 { qer_editorimage textures/phdm5/glass_break1.tga qer_trans 0.9 surfaceparm nolightmap surfaceparm nodlight surfaceparm trans sort additivie { map textures/phdm5/glass_break1.tga blendfunc filter rgbGen identity depthWrite alphaFunc GE128 } { map textures/phdm5/glass_env.tga blendfunc add rgbGen identity tcGen environment depthFunc equal } } The sort value must be 7 or more to work well with a skybox. For viewing health bubbles or torch fire through the broken glass shader at least 9 (additive). PS: Add "r_clear 1" to your config. This helps a lot spotting this kind of errors including missing/untextured faces... |
Author: | Pat Howard [ 04-24-2015 05:43 PM ] |
Post subject: | Re: broken glass shader |
@sst13: it works! thanks so much. @andyw/czghost: no harshness intended, sorry if i was too blunt. guessing i'm feeling better now that i've got this bug out of my map |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |