chrome/metal

Blitz3D Forums/Blitz3D Beginners Area/chrome/metal

Steven Noyce(Posted 2006) [#1]
How do I get a chrome or metalic look on an entity? I have tried extencively and can not figure it out. This is the code that I have so far.
robot=LoadAnimMesh("robot.b3d")
EntityFX robot,1

robottex=LoadTexture("robottex.bmp",1)
cubetex=CreateTexture(128,128,64+256)
TextureBlend cubetex,3
EntityTexture robot,cubetex,0,1
EntityTexture robot,robottex,0,0

It looks very cheesy.
Please post! I really want to get this working!


stayne(Posted 2006) [#2]
do you want to reflect the surroundings, or use a reflect map? you can use a reflect map that's similar to your surroundings and get an HDRI effect that looks halfway decent.


Steven Noyce(Posted 2006) [#3]
I already have a rutine that uses cubetex as a reflection texture. The thing is, chrome mirors and metal don't reflect the exact same color. For instance, mirors look silver, chrome can look other colors. What I want to do is somehow combine cubetex and robottex to get that effect.


stayne(Posted 2006) [#4]
make the following change. if it doesn't work, then i'm out of ideas.

cubetex=CreateTexture(128,128,64+1)
TextureBlend cubetex,2


Steven Noyce(Posted 2006) [#5]
That's strange, I made those changes and now it looks like I don't have the robottex texture applied at all. Thanks for the help, but it still does not work.


Steven Noyce(Posted 2006) [#6]
I have seen screenshots so I know that this is possible.
Could someone please help me out?


Baystep Productions(Posted 2006) [#7]
how about EntityShininess?

And maybe adding a texture over it of a shine as a sphere map.


Steven Noyce(Posted 2006) [#8]
Thanks. That could help too, but my main problem is making it look silver or colorfull instead of showing only the reflection color.


Ross C(Posted 2006) [#9]
What about applying a grey texture and messing about with the texture blend modes. Try all of them, before you give up :o)


Steven Noyce(Posted 2006) [#10]
I have tried all of them, but none of them seem to work how I want.

0-Makes entity apear only grey.
1-Makes entity brighter, but not any more grey.
2-Makes entity appear to only have the reflection texture.
3-Makes entity appear more white and washed out.
4-Makes entity appear very dark.
5-Looks the same as 1.

After trying these, I did not know what to do. If someone has done this, PLEASE HELP ME!


jfk EO-11110(Posted 2006) [#11]
When I made a water demo some time ago I had the same problem with the reflective water: too bright. So I used a simple trick to be able to adjust the brightness of the cubemap: I simply put a black cube around the cubemap camera (with FlipMesh). Using EntityAlpha I was able to darken the Cubemap, as well as to reduce it's reflection.

With Spheremapping you would have to darken the spheremap texture, pretty simple, although it may have no influence on its reflectivity, compared to the cubemap solution.

Check out the teapot example (seek for "teapot" in the examples folders), it sows how to achieve a nice polished copper look.


stayne(Posted 2006) [#12]
It would help if you would post a screenshot. Normally the only way you can get metal or chrome to reflect and look realistic is if the metal is textured well. It would be hard to do it otherwise. You could do a basic metal texture, then reflect it. If you take a look at this screenshot:



you'll notice that it's not perfectly slick and shiny... there's some noise going on. So find a basic metal texture, apply it to the entire model and then give it a go.


big10p(Posted 2006) [#13]
Yeah, post a screenie of the effect you're after.

You say you want to simply change the color/brightness of the effect - surely you can do this by just altering the color of the mesh (EntityColor). I guess it can't be that simple and I'm not understanding what you're trying to do, so, yeah... post a screenie. ;)


Steven Noyce(Posted 2006) [#14]
I want an effect somwhere in between this image and the one markd posted above.




stayne(Posted 2006) [#15]
how about a shot of it in your game?


Steven Noyce(Posted 2006) [#16]
This is just a picture off of the milkshape website. I don't have my own website so I can't post pictures of my own.
Sorry!


Steven Noyce(Posted 2006) [#17]
This effect is more like what I am after.



Ross C(Posted 2006) [#18]
You just need to create a good cubemap texture, or spheremap texture, maybe add a bloom filter to it.


Steven Noyce(Posted 2006) [#19]
What in the world is a bloom filter?

And more importantly, how do I make one?

One last question, could this "good cubemap" be dynamic?


Ross C(Posted 2006) [#20]
A dynamic cubemap would be good, but maybe too much of a load. It all depends what's in your scene. A bloom filter, from observing, seems to make everything glow.

Something a little like this:

http://www.blitzbasic.com/codearcs/codearcs.php?code=1351

or this:

http://www.blitzbasic.com/Community/posts.php?topic=30964


Steven Noyce(Posted 2006) [#21]
Ok, I think I know how to add a bloom filter. Now I am stuck on the "create a good cubemap texture" part. I know how to make a normal cubemap, but how do I make one that looks silver or some other color?


Dustin(Posted 2006) [#22]
It's not the color, it's what you are reflecting. Your posted character above is identical in it's reflections to the bike. The only difference is the image it reflects.

The 'crome' element you feel you're missing (I suspect) is the sky. Look at the bike. The highlights include very light colored green grass and a very light blue sky. Your object is reflecting a very dark room with a black ceiling. If the character is outdoors then just google search for something outdoors. For example:


If the object is indoors then it's impossible to get the bike to look like that unless we're inside a giant greenhouse.

One other thing, check the base color of your character. You'll want to make him at least grey (128 128 128) to properly reflect the light range of your image.


Mr. Bean(Posted 2006) [#23]
Maybe it's a good texture:



Steven Noyce(Posted 2006) [#24]
This file looks horrible.
http://www.freewebs.com/blitznerd/chrome/chrome.zip
Any ideas of how to improve it?


Steven Noyce(Posted 2006) [#25]
Sorry, the link does not work.

Just copy and paste this url into your browser.
www.freewebs.com/blitznerd/chrome/chrome.zip


Pongo(Posted 2006) [#26]
http://www.andimages.com/proofs/pongo/chrome.zip

Try this. Sorry I don't have time to do a more proper version, but these should help you. Try the different images to see a different reflection.

It all comes down to *what* you are reflecting, so the key is to have your reflection map match up with whatever your background is. Also, rounded surfaces will look much better than flat ones. Try changing the rounded cube to a flat cube to see what I mean.


Steven Noyce(Posted 2006) [#27]
Ok, so you did not use multitextureing and it looks quite good. Now my question is, why does this look so cheesy and dumb?
http://www.freewebs.com/blitznerd/robot/robot.zip

-EDIT-
And again, the link does not work. How do you make a link?


Ross C(Posted 2006) [#28]
The link does work, you just need to right click and save target.

You cubemap looks odd, because of the mesh you use too. It's very... err... bad :o) And you don't exactly have the best of surroundings to reflect. Plain old hills. Try moving your camera for rendering the cubemap, up a bit. It's a bit low down.


Steven Noyce(Posted 2006) [#29]
Ok, I moved the spheremap camera up one. That makes it look a little better. I know that my surroundings are not that exciting, but I didn't have time to make anything cool and even if I did I probably would not want to release it to everyone like I did with the one I am using. But even without the best surroundings, I still don't think that my robot looks anything like chrome or metal. Why not though?


Ross C(Posted 2006) [#30]
Try brightning up the textures used for the ground. Add some more contrast to them as well. It's mostly all in the cubemap. Try blurring your cubemap a bit too, see if that looks any better, and get a better model to test ;o)


Steven Noyce(Posted 2006) [#31]
Thanks for the advice. I have not tried it yet, but I am sure it will help a lot.
Do you know the fastest way to blur an image/texture?

It would be good to know for many purposes, not just this one!


Pongo(Posted 2006) [#32]
Basically, it looks like you are doing what needs to be done.

To make better looking reflections, you will need:
1. Something to reflect. Currently, the ground is very absent of anything that will make a cool reflection.

2. A better mesh that is reflecting. This is very important. a curved surface will pick up reflections better, since it is getting information from multiple areas of the reflection map. A flat face by itself will only see a very small part of the map, and will not have much to look at.

Hope this helps some. If I get a chance I will make a better example in the next few days,... no promises though.


Mr. Bean(Posted 2006) [#33]
If you download BCF (a GUI LIB) there are samples included (for GUI), but there is also a good chrome-effect.


_PJ_(Posted 2006) [#34]
All I use is the normal texture, then I blend a reflection map on top of it, the reflection map texture is the one with the 64 flag set. Currently, I'm happy with this reflection map:





Shifty Geezer(Posted 2006) [#35]
You use two textures for the reflection. The first is a standard cube or spherical map with normal blending. The second is the same picture as the first adjusted and blended with additive blending. Take the first picture and adjust the brightness and contrast so the white remains white and brightness quickly fades to black. Add a little guassian blur for 'bloom'.

You need properly normalised meshes too. A standard Cube won't reflect the right parts of the image map.

Here's a demo...

http://www.davidcoombes.f2s.com/chrome.zip



The maps were for a scene with a square, grey table, which I rendered with GI and had as a mesh. As it happens I forwent the photographic style for a cartoon renderer. Producing blurred cube-maps is also a complicated process if you don't want seems.

You of course need maps that look similar to your surroundings. Or failing that, go with a contrasty light and dark image. Graphics apps like PSP often have a collection of textures including chromey ones. Because chrome is invariably photographed in bright rooms with black trimming to hide the photographer, that representation of chrome is so common it doesn't like bad even where it's unrealistic.


Steven Noyce(Posted 2006) [#36]
Thanks! That looks realy good. The only issue I have with it is that your textures that you are loading already look like chrome. So how could I make a realtime spheremap like that?


Shifty Geezer(Posted 2006) [#37]
Probably not quickly enough! You'd need to render a realtime spheremap, and then copy the texture and filter it. If you're only aimng for highend computers that shouldn't be a problem, but realtime reflections are few and far between because it is a very demanding effect. Most games fake chrome with just shiny-looking textures rather than trying to capture something real.

If you want to render the sphremap, I'm not sure quite how to do it. A camera placed at the object facing the camera that renders the scene and copy to that to texture, would need a 'fish-eye lens' with very short zoom. I don't think Blitz (or D3D for that matter) renders the curvature of the perspective, so you wouldn't get a proper sphere. You could write a deformation filter to bulge a rendering, but that'd be even MORE demanding!


Steven Noyce(Posted 2006) [#38]
I know it would probably be slow, but I am kind of wierd that way. I like to know how to do things no matter how impracticle they are. It just seems so cool to me to be able to get a good looking effect. Also, it helps me understand how to fake that effect and still have it look good. How did you make your textures?

Still any advise or theories about how to do this realtime would be greatly appreciated!


Shifty Geezer(Posted 2006) [#39]
My textures came from some spherical environmental pics and a 3D graphics app. These images are generally produced by photographing a reflection in a mirrored sphere. That's how movie CGs do it too. That image was unwrapped to a rectangular image.

I sphere mapped that onto a sphere in a 3D graphic app, and rendered 90 degree FOV square images from a camera in the centre for each of the 6 directions. That produced the cubemap. I also added a table model with a GI rendered illumination map applied which appears in the spherical map and looked a lot better than a bright red carpet when the objects were sat on a grey table!


Steven Noyce(Posted 2006) [#40]
Thanks,
is there any way to get a texture like yours from a normal picture?


Shifty Geezer(Posted 2006) [#41]
Not really. Best bet is to apply is as a spherical map, which works quite well in many situations. If you have a 3D program you could apply a standard photo with a linear mapping to a sphere, and take 6 views to build a cubemap. This would mirror the front and back faces, and produce stretched left and right, top and bottom face images. You could probably create a simlar effect with an art package using blurs and rescales and things. Don't know how that'd look though. If kept as a small image, the texture scaling would blur it out a bit so you wouldn't notice. You wouldn't have sharp chrom like reflections, but could get a more steel-like look.


Steven Noyce(Posted 2006) [#42]
One more question, What makes chrome look like chrome?
For example, you look at a miror, and you look at each real color and the color in the miror. They look exactly the same. Yet the whole miror somehow looks silver at the same time. Why does it not just look like a window into another of the same room?


big10p(Posted 2006) [#43]
Pongo: the sphere map textures you use in your demo work very well. I was wondering if you could give some tips on how you created them? I'm particularly interested in this one:

It works very well and is almost perfect for my current needs. I would like to be able to create a texture like this for my own use, but make it square (for compatibility), and maybe make a cubemap version. So, any tips you can give would be much appreciated, or, if you didn't make them, can you say where you got them from? Thanks.

P.S. I thought I'd post this here instead of emailing you, in case any tips you give are useful to others. :)


Steven Noyce(Posted 2006) [#44]
Yeah, I was also wondering how you made those, but I was more interested in the reflect3 one.