Cube Map demo

got glsl now.
wooooow.
how did you do it?

Hey Martinsh, EnvMap option implemented inDome mode (envmap == 2).
Give it a try and tell me if it works for baking cube maps as you wanted to :slight_smile:

http://wiki.blender.org/uploads/1/19/Dev-GameEngine-Dome-EnvMap.jpg

Windows build:

Nice!!
By “Baking” you mean taking screenshot from viewport right? :wink:

Question: is it possible to get dome projection working only for specified camera, for example if i want to grab EnvMap with VideoTexture and then apply as dynamic cube map on a mesh. That would allow to make real car reflections.

I also have thought about it. I believe that to create the cubemap we need a render of 2 steps, one for the camera envmap and the other for the final rendering of the screen. something like:
/uploads/default/original/3X/7/b/7b2c0a113e8477aefe08dff6053d8c2b27778c97.jpgd=1240484087

But I think this is not possible without that we can specify which camera envmap run and what will work without it :frowning:

Attachments


Not sure really. I mean they have found workarounds for it. I’ve heard that updating drivers is working so maybe ATI is more interested than I originally thought. I don’t think either can fix the problem but if Twilight 22 takes off in the way many blender users hope it will then it will draw attention to this lacking feature in ATI and make improvement a higher priority (if it isn’t already)

How do I bake a cubemap for the best result? When I try to do it, the parts isn’t in the same position/rotation as in the demo file and the reflection isn’t in the right place.

Could you clarify that please?
Can you show what is the result you get and the result you were expecting?

I tried to make the ocean shader (from the thread about that) mirror my own skydome. I haven’t used envmaps before but googled it and got my six part image from the skydome. But it didn’t look right, so I opened the file that came with the demo. My had all parts upright, with the clouds in the top, in the demo each part is rotated 90 degrees. And they are in different places. Are there settings to it that I miss? I tried edit the picture but I got a little offset.

Maybe I should start in the other end:
How would I go about applying the ocean shader or cubemap demo’s on my own enviorments?

sorry about the confusing text, but I don’t have explanatory screenshots/images available.

Ah yes, there was a little problem with that :slight_smile:
before making env-map, you have to rotate the object, that you use for baking, 90 degrees on X axis. :slight_smile: ( i guess that it can be fixed in shader itself)

Together with Dalai we fixed the cube-map orientation problem when the object is rotating .
Here is a blend. CubeMap_Blender_OriFix.blend (317 KB)

Is refraction the effect halo uses to get the cloaked effect? (whenever you become almost invisible, but you can see a slight waviness…)

Thank you! I will try it. Should the object be anywhere in particular or just in the centre of the scene?

The new file gives an error.
ERROR: 0:14 ‘’ : Matrix construction from matrix is not allowed in GLSL1.10

Just tried the new file and updated it to get rid of deprecation warnings in 2.49 just to see how easy/difficult it would be (it was pretty easy ;)).

Changed getObjectList() to *.objects
Changed obj.getMesh() to obj.meshes
Changed main loop to use “mesh_index < len(obj.meshes)” as the while loop condition.
Moved “mesh = obj.meshes[mesh_index]” to the start of the loop and removed initial assignment from outside the loop.

I’m getting 140fps. :slight_smile:

CubeMap_Blender_OriFix_249.blend (318 KB)

I’m still getting the console error:

---- Vertex Shader Error ----
(14) : warning C7536: OpenGL does not allow matrix casts without #version 120 or later
---- GLSL Program ----
Vertex info

(14) : warning C7536: OpenGL does not allow matrix casts without #version 120 or later

Is this a problem with OpenGL on my laptop or GPU or is it the version that Blender 2.49 is compiled with?

Edit: Oops, just tried out my idea and it didn’t work. Ignore the edit. :wink:

Try to replace line 14 with:
dir = mat3(cam2world) * reflect(view, normal); // GLSL 120

It should work.

Currently I am looking to do exactly this thing, but I can’t seem to find a way to update the EnvMap in the game engine.

I have tried to combine two tutorials in the attached file:

  • rendering to texture with VideoTexture
  • This nice blend which implements reflection (cube) mapping

Note that the example uses PIL (python imaging library found here) to construct the environment map (6 images).

The problem I am getting is the following:

RuntimeError: 0: Texture material is not available

on this line of code:

matID = VideoTexture.materialID(obj, "MA" + obj['material'])

When I change the texture type to “Image” I don’t get this error from VideoTexture, but I don’t have a usable cube map for the shader.

Does anyone have an idea how to update the environment map dynamically?

Attachments

CubeMap-envmap.blend (605 KB)

Does anyone have an idea how to update the environment map dynamically?

This would be quite a boon to all of us!