DaveLee Posted April 19, 2010 Share Posted April 19, 2010 I'm looking to create some softer decals, but the _alphatest shader seems to only read pixels as 100% opaque or 100% transparent. Ideally I would like to be able to paint gray areas in my alphas for softer edges. After digging through the shaders I haven't found anything that works. Does anyone else have an idea? Quote Link to comment Share on other sites More sharing options...
Gandi Posted April 19, 2010 Share Posted April 19, 2010 try: blend = alpha in your mat file instead of using alphatest (alphatest clips all pixels with alpha value < 0.2 i think) Quote Link to comment Share on other sites More sharing options...
DaveLee Posted April 19, 2010 Author Share Posted April 19, 2010 I knew there was a way to do an alpha blend, hah! That's exactly what I needed, thank you good sir. Quote Link to comment Share on other sites More sharing options...
Michael Betke Posted April 19, 2010 Share Posted April 19, 2010 I like this decal! Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
Kazar Posted May 1, 2010 Share Posted May 1, 2010 I knew there was a way to do an alpha blend, hah! That's exactly what I needed, thank you good sir. Could you paste your alpha blend .mat file, please? Quote Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64 Link to comment Share on other sites More sharing options...
DaveLee Posted May 1, 2010 Author Share Posted May 1, 2010 Sure thing: texture0="abstract::whitebrickdecal01.dds" texture1="abstract::oldpaintedbrick01_dot3.dds" overlay=1 blend=alpha shader="abstract::mesh_diffuse_bumpmap.vert","abstract::mesh_diffuse_bumpmap_specular.frag" shadowshader="abstract::mesh_shadow.vert" Quote Link to comment Share on other sites More sharing options...
Kazar Posted May 2, 2010 Share Posted May 2, 2010 Thanks. This is a lot better looking alpha for my purposes, but the problem now is that I can't seem to do two sided alpha for e.g. fence by cullface=0. Any workaround, or do I simply make two planes facing opposite sides? Edit: played around with it and got it working for my scene. Quote Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64 Link to comment Share on other sites More sharing options...
L B Posted May 14, 2010 Share Posted May 14, 2010 Trying that for grass/leaves. I get some kind of ugliness plane as it does not get cut through alphatest. Any idea? Quote Link to comment Share on other sites More sharing options...
Gandi Posted May 16, 2010 Share Posted May 16, 2010 guess you will have to move the grass into the transparency layer.. Quote Link to comment Share on other sites More sharing options...
L B Posted May 16, 2010 Share Posted May 16, 2010 Problem is that transparency layer isn't affected by neither lights or distance fog. Quote Link to comment Share on other sites More sharing options...
DaveLee Posted May 21, 2010 Author Share Posted May 21, 2010 Is anyone else getting weird behavior with "blend=alpha" is version 2.32? I'm not seeing anything directly behind the alpha blended object be rendered at all. Quote Link to comment Share on other sites More sharing options...
franck22000 Posted May 22, 2010 Share Posted May 22, 2010 i got weird behavior too with alpha Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
L B Posted May 22, 2010 Share Posted May 22, 2010 I think that's the very principle of deferred rendering. *Sigh* Can't wait for LE3=OGL4=MSAA. Quote Link to comment Share on other sites More sharing options...
Gandi Posted May 22, 2010 Share Posted May 22, 2010 you will always get strange results when using alpha blend, if not using in its own world, thats because of the deferred shading. if your render in the normal world without skipping the invisible pixels the depth buffer will also be written at "invisible" pixels, so the whole plane gets rendered. when lighting the plane gets lightened even if its not visible there --> you see the plane again. what i was thinkin about is: rendering all visible pixel (alpha=1) in the normal color buffer and rendering all pixels with alpha<1 in another color buffer at the same rendering call. then compute the lighting for both buffers and blend the transparency buffer on the first color buffer. i know thats pretty much like the transparency world, just that the shadows(exept the pixels with alpha<1) get drawn and that the collisions will also work as it's all in the same world problems: 1 more computeLighting call -when there is a object with alpha<1 behind an object with alpha<1 (but thats also in the transparency world) -the shadows dont get calculated for pixels with alpha<1 €: sry.. forgot that i'd also need my own depth buffer then.. Quote Link to comment Share on other sites More sharing options...
Michael Betke Posted July 20, 2010 Share Posted July 20, 2010 How have you solved this issue dave? I have black spots where it should be transparent. Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
Canardia Posted July 20, 2010 Share Posted July 20, 2010 I have no problems with transparent, a bit bluish tinted, windows in my game. I just move all windows to the transparency (foreground) world, and windows show all shadows and lights behind them, and also cumulate (you can still see through multiple stacked windows and the color adds correctly too)! Cumulative transparency is no problem in deferred rendering engines, you just need to do it right. In the mat file for windows I use blend=alpha, color=1,1,1,1, and the window texture has an alpha channel and is colored light blue. Framework must be used for rendering, because without it, you would have to rewrite it 1:1 with all the buffer and rendering logic, resulting in the same situation as using it. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Michael Betke Posted July 21, 2010 Share Posted July 21, 2010 So no way to do a simple decal on a wall in the editor with stock Leadwerks? This is really annoying because I need to do some buildings with derelict look and its essential to have some dirt decals on my models. Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
macklebee Posted July 21, 2010 Share Posted July 21, 2010 you can use decals in the editor... granted it still has bugs outside of it... what kinda texture are you trying to apply? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Canardia Posted July 21, 2010 Share Posted July 21, 2010 I have in the model's Lua script the LoadModel call which loads all transparent submodels to the main model. So it works transparently in Editor and in the game. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Michael Betke Posted July 21, 2010 Share Posted July 21, 2010 I'm doing some models in 3dmax. Afghans rural buildings. Base texture is mud with some vertex painting for variation. But I need some decals for stains and additional dirt on the walls too. They are simple planes which I detached from the model and they get exported with the building. So no extra mesh just for decals. All in one building. It should look like the one Dave made on his screenshot. At the moment I see the bricks at the spots where I have the white alpha but at the spots where the decal should be transparent its just black. I used the same material file like Dave posted aboove. Alpha is located in diffusemap. Normalmap has specularity. Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
Josh Posted July 21, 2010 Share Posted July 21, 2010 There is a way to do this with lighting intact. The roads are one example. Will look at it when I get out of bed. i'm typing on my phone right now . actually i m just speaking into it Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Michael Betke Posted July 22, 2010 Share Posted July 22, 2010 Wow with just entering by voice? What phone do you use? I found a solution with intesive searching the forums: My material file is just: texture0="abstract::mud_clean_rocks_dcl.dds" texture1="abstract::mud_clean_rocks_dcl-norm.dds" blend=alpha depthmask=0 zsort=1 overlay=1 No shader stuff in it. I have no idea why it works but I have the look I'm looking for. So I don't care, hehe. So I have the building texture based on two textures which are vertex painted. Plus the decal with smooth mudwall to brick transition. Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
DaveLee Posted July 22, 2010 Author Share Posted July 22, 2010 Sorry for the late reply! It looks like you figured it out. Alpha blend behavior seemed to change for some reason in 3.32, but I'll have to try out your material code and see if that works. I had actually gone back to a straight alpha test until I had time to look at it. Quote Link to comment Share on other sites More sharing options...
Michael Betke Posted July 23, 2010 Share Posted July 23, 2010 ALphatest looked very strange. Maybe I will use alphatest for posters, grafitties or such stuff. Quote Pure3d Visualizations Germany - digital essences AAA 3D Model Shop specialized on nature and environments Link to comment Share on other sites More sharing options...
DaveLee Posted July 24, 2010 Author Share Posted July 24, 2010 I think alpha test evaluates the alpha map pixel by pixel as either 100% transparent or 100% opaque, with no middle ground. I can confirm that removing the shader information and using the material settings that Michael posted above produces the correct decal effect. Awesome! This issue had been bothering me for a while now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.