specular
Blitz3D Forums/Blitz3D Programming/specular
| ||
can blitz 3d do proper specualar, ie from a texture map |
| ||
You can use a spheremap or a static cubemap (I think) to get a decent specular highlighting effect. Is that what you mean? |
| ||
Although dx7 supports it Blitz3d does not. |
| ||
why? |
| ||
Nobody knows... that's the honest answer :o) Same with DXTC (texture compression). You can do Specular mapping with a normalmap and a cubemap, using the normal map to act like a mask, to mask out pixel you don't want lit. |
| ||
I jsut wanted to do a standard specular highlight using a texture map like below seems as though its not possible though |
| ||
You can cheat specular maps easily by using multitexturing. I can't get to it right now, but I can post an example perhaps tomorrow to show what I mean. |
| ||
Okay - I'll wait here. |
| ||
You have to render the specular surface in one pass, then render the second pass using the specular map as an alpha channel. |
| ||
if anyone could post a brief example, that would be cool. |
| ||
Here is an older example I made to show a specular effect with a metal texture. It could be optimized a bit to work with fewer textures, but this method shows all the steps clearly. You can comment out each of the steps to see the result build. www.andimages.com/proofs/pongo/specular.zip Here are the steps summed up. Step 1 : assign the base texture step 2 : assign a reflection map to act as lighting step 3 : this is the key step. Use a mask texture using multiply mode to block over the reflection from step 2. step 4 : now apply the non-reflective texture using additive mixing. This texture needs to have the mask pre-applied to it (and inversed) so that you will only be adding to the black areas from step 3. I tried to comment this a bunch, but feel free to ask if there is something confusing here. |
| ||
Ruz, convert that into a normal map. Then apply the normal map, then the specular map, as a lightmap, then... i think a cubemap. I'll need to check that actually... |
| ||
Wrong forum There's Blitz3D Programming for a reason. |
| ||
cheers guys. I will look at that. Thanks for the sample Pongo. |
| ||
Hey, nice example, Pongo. ;) |
| ||
Very good example Pongo. I suppose you could give that Mask texture an alpha channel, to have certain pixels a semi-shine? |
| ||
Expanding upon pongo's code and setup. Here's another example. I think it demonstrates the effect more: www.rosscrooks.pwp.blueyonder.co.uk/specular.zip Nice code pongo ;o) |
| ||
No need to use an alpha channel on the mask, simply using grey values will work because of the multiply blending mode. |
| ||
hmm, wish it were a bt simpler. tried using blitz pipleline but it seemed very flakey. I just wish we had simple commands for stuff like this, not workarounds |
| ||
Ruz, you can always covert this to function, something like: DoSpecular(box,base.bmp,ref.png,mask.bmp,overlay.png) Easy... and by using stadard naming it gets eve easier, like box.b3d -> map box.tga, box_m.tga (mask), box_o (overlay) etc. IMO it's good to name your maps consistently anyway so that you know what is what and goes to where. |
| ||
thnks for teh nfo mustang . I got the effect working ok , but i would like to have it so that the lights in my scene actually effect the specular, not a fake light from a texture map jsut wondered if anyone knws of a reason why you could n't do proper specular in Blitz 3d. Is that a directx 9 shader thing |
| ||
here you go,... use the same media from the specular demo. The unfortunate thing here is that I have to duplicate the object to create the specular effect, but it works here. I don't know if this will cause z-buffer issues on some cards, but maybe someone can expand on this. |
| ||
you are a star mate thanks for that. might be tad expensive, but its nice too see this progressing. any way of doing a kind of multipass render without actually duplicating the box |
| ||
jsut wondered if anyone knws of a reason why you could n't do proper specular in Blitz 3d. Is that a directx 9 shader thing Hardly! Specular is ancient thing in the 3D world... Blitz3D just doesn't have that "coded in" so that it would be easy to use for users, ie like with separate specular mask maps like you usually do this "effect" in other languages and rendering softs. Blitz3D is surprisingly basic (pun intended) in some features, but yet it has for example Modulate2X blending. any way of doing a kind of multipass render without actually duplicating the box That's a same thing, Ruz - you are rendering things twice in both cases. Multi-pass is just more expensive (fps wise) than having just one object duplicated. |
| ||
ahh ok. the only other problem is that shininess looks inherently bad unless you have a very smooth object Yeah i am amazed that blitz does n't have proper specularity |
| ||
shininess looks inherently bad unless you have a very smooth object That is why I like to use reflection maps as fake lighting. The result is much smoother than the vertex-dependent lighting you get with the scene lights. Oh, and Mustang, since I see you are reading this thread, and are probably one of the more qualified people around here to answer, do you know of any other methods for doing the specular? Have you seen any issues with the object duplication trick? Like I said before, it works fine here, but I'm a bit concerned about z-buffer issues on some cards. |
| ||
I used alpha / object duplication on my "Planet demo" for making the specular effect... no problems but that was easy case because there was only the planet and background nebulas. Well in fact there was also few cloud layers and stuff but too... It would be easy to test z-problems by creating many scattered objects and making the move so that they will overlap (depth) each other. That should reveal z-order problems quite quickly. Also don't forget that Blitz3D has an alternative for z-buffer which is worth checking out too: http://www.blitzbasic.co.nz/b3ddocs/command.php?name=WBuffer&ref=3d_cat |
| ||
Apparently cubemaps don't work using the w-buffer. |
| ||
Hey, anyone got a copy of Pongo's original demo? I am trying to collect useful things and will host it for future people. Email address in profile (or just host it) |
| ||
I think the Ashadow library offers specular. |
| ||
I still have it here somewhere, but I'll have to dig a bit for it. Will try to post later. |
| ||
Its ok, I figured it out from your description of the process. It would be interesting to combine your process with the image negative code from here: http://www.blitzbasic.com/codearcs/codearcs.php?code=1772 so you would only have to supply it with a spec and color map, and it would generate the 4th map for you. |
| ||
I didn't get a chance to look for this last night, so I'll have to find it this weekend. I may just make a new demo that showcases the effect, since I was never completely satisfied with the old demo anyways. Stay tuned. |