How to create a shinny black cube?

Blitz3D Forums/Blitz3D Beginners Area/How to create a shinny black cube?

Rick Nasher(Posted 2015) [#1]
Hi guys,

Pretty sure this is a beginners question so here goes:
I'm trying to create a black shiny cube like object, but failing to get it right.

I've noticed that for instance in Cellular the red blood cell torus, is easy to make shiny. I'm guessing due to amount of segments.
However I thought should also be possible to make a low poly cube shiny.
I know how to apply a cube map to give it a mirror/metallic shine, but that doesn't work on a deep black surface as far as I can see.

Any body have a clue?


RemiD(Posted 2015) [#2]
If you only want the "shiny effect" when a light is near enough, you can use a subdivided cube :
for each face, instead of having 2 triangles, you would have 10x10x2 triangles
You can build a subdivided cube in a modeling program or inside blitz3d.
Then you need to modify the shininess of the cube surface either with entityshininess() or with brushshininess()
http://www.blitzbasic.com/b3ddocs/command.php?name=EntityShininess
http://www.blitzbasic.com/b3ddocs/command.php?name=BrushShininess

If you want reflections on the cube, you can use a precaptured cubemap.
See : http://www.blitzmax.com/codearcs/codearcs.php?code=1167
If you want to see reflections on the cube, the environment must have different shapes with different colors...


Rick Nasher(Posted 2015) [#3]
Hi RemiD.

Best I came up with sofar is a modified version of the SetCubeMode example[/a] from the Blitz3d help files..
C:\Program Files (x86)\Blitz3D\help\commands\3d_commands\SetCubeMode.htm



But this is not satisfying(enough). Your suggestion of increasing the triangles is probably the only correct solution. Many thanks.


RemiD(Posted 2015) [#4]
Another way to produce a fake reflection / fake shininess effect is to add another texture over the texture of the cube, and to use positiontexture() to move the texture depending on the camera movement.


RemiD(Posted 2015) [#5]
It depends on the effect that you want. I remember than in the game "Drakan" the shininess of the gems was made by creating particles (like small suns) on different triangles which progressively increased in size and then were deleted. Very nice effect.

Here : https://www.youtube.com/v/fXDo7Fta4Ig?start=904&end=960


_PJ_(Posted 2015) [#6]
Another way to produce a fake reflection / fake shininess effect is to add another texture over the texture of the cube, and to use positiontexture() to move the texture depending on the camera movement.

Using the built-in reflection map filters can do this simply and effectively.
Applying the second texture with flag 64 will update the display of the texture depending on the view without the need to modify positiontexture each frame.


Rick Nasher(Posted 2015) [#7]
Thanks for your suggestions guys.

@ _PJ_:
Flag 64 = Spherical environment map. I've never seen that in action. Actually, before I resorted to the cube mapping solution I was trying to find some code for spherical mapping, but was put off by people stating couldn't be used in Blitz. Now I'm thinking they may have not been using as intended.

Do you have a little example for this? What should the second texture look like?


RemiD(Posted 2015) [#8]
There are some examples of spherical environment map in the Blitz3d samples. But from my tests it will look good only on a mesh with a complex shape. (=not a cube)


Rick Nasher(Posted 2015) [#9]
Ah, that's a pity. Sounded almost too good. lol


RemiD(Posted 2015) [#10]
If i remember correctly, with a spheremap you cannot use only a precapture of the environment because then the same texture is used whatever the position that the camera is, so if you look at the shape and it shows something behind or at left or at right of the shape, the reflection will appear weird...

With a cubemap you can use a precapture (6 precaptures : front, back, left, right, top, bottom) and then only the turning moving entities will not be shown on the reflection, but the reflection will appear convincing enough.


Rick Nasher(Posted 2015) [#11]
Given _PJ_'s comment I was under the impression that I missed something and the sphere mapping was the default automatic function of Blitz3d and cube mapping the more advanced version.


RemiD(Posted 2015) [#12]
this may give you some ideas :
Blitz3D\samples\mak\multi_tex


Rick Nasher(Posted 2015) [#13]
Many thanks RemiD. Gave it a try and appears you are right.


Rick Nasher(Posted 2015) [#14]
Solution.
(Just added for completeness and anyone interested. Please don't comment on the messy code; didn't bother to clean or anything.)
Thanks to the guys who contributed to sorting this out.


Media required): a box model(link) with more triangles then the standard cube.

*Above example was derived from: "C:\Program Files (x86)\Blitz3D\help\commands\3d_examples\SetCubeMode.bb" and rest of media can be found there in the media folder. (need to adjust to your path to blitz of course)