[Bf-committers] Anymated textures in the 3Dview

Ton Roosendaal ton at blender.org
Thu Feb 11 10:55:13 CET 2010


Hi Benoit,

Thanks for the cool study, one remark though;

> It calls the BKE_image_get_ibuf() function to get the image buffer.
> It passes NULL as second argument, which means that the last loaded
> image from the movie will be returned.


The API description is:

*BKE_image_get_ibuf(Image *ima, ImageUser *iuser)

The ImageUser struct is required if you want to do anything fancier  
than just a simple image. It's needed for image sequences, movie  
files, or multilayer. The ImageUser struct sets begin/end, duration,  
fps, and so on.

Now... probably this ImageUser has to be put in Object? Mesh? Will ask  
the experts :)

-Ton-

------------------------------------------------------------------------
Ton Roosendaal  Blender Foundation   ton at blender.org    www.blender.org
Blender Institute   Entrepotdok 57A  1018AD Amsterdam   The Netherlands

On 10 Feb, 2010, at 21:12, Benoit Bolsee wrote:

> Hi,
>
> Recently, based on my status of the VideoTexture module mantainer,  
> I've
> been asked whether video textures could be displayed dynamically in  
> the
> 3D view (based on frame number). Unfortunately, the BGE and Blender  
> use
> a different realtime render engine, so the VideoTexture module is no  
> use
> in Blender.
>
> Nevertheless, I've studied the question and isolated the places in the
> code that must be changed to allow dynamic textures in the 3D view. I
> thought I would release this information as some Blender dev might  
> want
> to implement the changes.
>
> /benoit
>
>>>>>> Here is the study:
>
> I finally had the time to look into that. It is not a simple  
> problem. I
> have identified the 2 missing links to get animated texture in the 3D
> view but I'm not confident to implement them. The affected code is  
> part
> of the Blender UI render engine that I'm not familiar with.
>
> I can give pointers to the code. Note that the following explanations
> are applicable to Blender 2.5.
>
> The function that is not doing the right thing is GPU_verify_image()  
> in
> source/blender/gpu/gpu_draw.c This function is called whenever a
> textured face must be rendered in the 3D view. It calls the
> BKE_image_get_ibuf() function (line 447) to get the image buffer. Note
> that it uses a Image object, which is the central place in Blender  
> where
> images are stored, including images from movies. It passes NULL as
> second argument, which means that the last loaded image from the movie
> will be returned.
>
> This is not a problem if the image corresponding to the current frame
> was loaded before this function is called. Unfortunately, there is no
> proper mechanism in Blender to ensure that. I found that displaying  
> the
> Texture in the Button panel partially works: the frame number is  
> updated
> whenever you modify something on that panel. This could be fixed by
> proper notifier/event but has the inconvenient that you have to keep  
> the
> texture panel opened. A better way would be scan all Images (there  
> is a
> global link of such objects) and update those pointing to movies
> whenever the frame number is changed. I don't think that is  
> particularly
> difficult to do.
>
> The second problem is at line 446: if the image was already bound to a
> GPU texture, it simply rebinds and the image is not reloaded.  The
> proper load code is below at line 553. The idea would be to keep at
> Image level the number of the frame that was last loaded on the GPU  
> and
> if it differs from the frame returned by BKE_image_get_ibuf, reload  
> the
> image. Again I don't think this is complicated to do.
>
> <<<<<<
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



More information about the Bf-committers mailing list