Jump to content

Video as a diffuse map


photo

Recommended Posts

Read the documentation: there is no mesh_material/mesh_skinned_material with video support. Video playback is only supported by WidgetSpriteVideo GUI element. There is also a UNIGINE sample for draping GUI on a mesh, maybe these 2 elements can be used somehow for achieving your desired effect. Otherwise I think you will have to implement it on your own with WidgetSpriteVideo as a blueprint (assuming you have source code access)

Link to comment

Than create a new mesh material with 3D texture support for storing multiple diffuse (normal,specular) texure "slices" and a new parameter for texture slice selection. Of course a 3D texture will can only support a limited number of slices due to high memory consumption.

Link to comment

Create 2d atlas of frames. You can pack 256 different frames with 256x256 size in the single 4096x4096 texture. And set texture transformation which will switch frames: { int f = int(engine.game.getTime() * 4.0f); return vec4(1.0f/16.0f,1.0f/16.0f,(f%16)/16.0f,(f/16)/16.0f); }

  • Like 1
Link to comment
  • 3 weeks later...

Create 2d atlas of frames. You can pack 256 different frames with 256x256 size in the single 4096x4096 texture. And set texture transformation which will switch frames: { int f = int(engine.game.getTime() * 4.0f); return vec4(1.0f/16.0f,1.0f/16.0f,(f%16)/16.0f,(f/16)/16.0f); }

 

cool - would it be possible to use something like this to calculate rolling tyres?

Link to comment

In principal for sure but for low rotation rates I would expect some visible jumps between different atlas tyre frames (if you want to simulate tyre rotation without rotation of tyre geometry). Nevertheless a combination of tyre geometry rotation and speed-dependent texture frame selection of pre-motion-blurred tyre texture (with maybe 3-5 discrete rotation speed variants) can be used to avoid unwanted stroboscope-effects at higher rotation rates.

Link to comment

Also possible. Regardless of actual approach increase of draw call count / posibble decrease of performance should be kept in mind as each per-instance modification of material parameters (e.g. texture parameters) will cause creation of an inherited material instance breaking engine instancing possibilities.

Link to comment

as it turns out we tend to have a lot of vehicles travelling at the same speed and at a constant speed but I will have to figure out how to make that work using instances

Link to comment
×
×
  • Create New...