Image sequence texture in Luxblend25

Please use this forum for general user support and related questions.

Moderator: coordinators

Forum rules
Please include your operating system type/version, LuxRender version and Exporter version used when submitting a support post.

Make sure you have read the Release forum thread for Release and RC (Release Candidates) builds as these threads contain information on known problems and workarounds: Test Builds Forum

Image sequence texture in Luxblend25

Postby Jaalto » Thu Sep 01, 2011 7:58 am

Hey,

Any chance to use an image sequence as a texture in luxblend25 for animations?
I loaded a .PNG sequence into Blender's image sequence texture but in Lux Log I get a float not found error. I can't get my hands in the float/color controls since I'm using Blender texture type and Luxblend seems to export it to imagemap float as a default.
User avatar
Jaalto
 
Posts: 13
Joined: Tue Nov 23, 2010 7:08 am

Re: Image sequence texture in Luxblend25

Postby J the Ninja » Thu Sep 01, 2011 9:26 am

Should work...at some point code was added to make Blender Image textures auto-detect float/color, and now I can't remember if that's in the 0.8 version or not. Might need to switch to the 0.9 dev version. If you still get the error with the latest code from the repo, 95% sure that's a bug. What channel were you trying to use it on?
-Jason

Material DB Admin
User avatar
J the Ninja
Developer
 
Posts: 2210
Joined: Wed May 19, 2010 9:54 pm
Location: Portland, USA

Re: Image sequence texture in Luxblend25

Postby jeanphi » Thu Sep 01, 2011 9:48 am

Hi,

I seem to remember it's been added in v0.9, not v0.8.

Jeanphi
jeanphi
Developer
 
Posts: 6579
Joined: Mon Jan 14, 2008 7:21 am

Re: Image sequence texture in Luxblend25

Postby Jaalto » Thu Sep 01, 2011 11:18 am

All right! I'll switch to 0.9 then and try that out. Thanks Jeanphi.

J.the N. -> Diffuse color was the channel.
User avatar
Jaalto
 
Posts: 13
Joined: Tue Nov 23, 2010 7:08 am

Re: Image sequence texture in Luxblend25

Postby Jaalto » Mon Sep 05, 2011 7:26 am

Okay, I gather it's a bug in Blender, because I can't get the image sequence to work even with the internal renderer. It only works with a video file and that doesn't translate to lux.
So, switching forums.

edit: Well well well. It seems that a pebcak by some degree was taking place there. I did get the image sequence to work with internal, Blender is a bit meticulous about the naming. But! Still the image doesn't translate to Lux.

I'm running OSX, Luxrender 0.9dev, Luxblend0.9.0, Blender 2.59a Official.

Image
Image
User avatar
Jaalto
 
Posts: 13
Joined: Tue Nov 23, 2010 7:08 am

Re: Image sequence texture in Luxblend25

Postby mtoivo » Mon Sep 05, 2011 12:09 pm

Hi. It seems 0.9 exporter has no support for texture.image.source that is of type 'SEQUENCE'. This is the case, no? At least I couldn't find anything in the materials.py, that would take care of that type of textures. I'm planning to add that, if no one has yet done it. I suppose blender will give out the correct filename, if asked kindly enough (since itself knows what frame of the sequence use).
mtoivo
 
Posts: 41
Joined: Sun Jul 25, 2010 4:20 pm

Re: Image sequence texture in Luxblend25

Postby J the Ninja » Mon Sep 05, 2011 12:23 pm

mtoivo wrote:Hi. It seems 0.9 exporter has no support for texture.image.source that is of type 'SEQUENCE'. This is the case, no? At least I couldn't find anything in the materials.py, that would take care of that type of textures. I'm planning to add that, if no one has yet done it. I suppose blender will give out the correct filename, if asked kindly enough (since itself knows what frame of the sequence use).


It should. I was under the impression this was all automatic. Silly me. :p

Go for it, happy coding. :)
-Jason

Material DB Admin
User avatar
J the Ninja
Developer
 
Posts: 2210
Joined: Wed May 19, 2010 9:54 pm
Location: Portland, USA

Re: Image sequence texture in Luxblend25

Postby mtoivo » Mon Sep 05, 2011 2:51 pm

J the Ninja wrote:Go for it, happy coding. :)

Thanks. I quickly browsed through the Image-objects propertys/methods, and couldn't find the "correct" filepath of the texture. Blender itself knows it, it is even displayed on the panel... I left a question to Blender's forums, hoping that the info is exposed to Python API. If it is, implementing sequenced texture support shouldn't be that big deal.
mtoivo
 
Posts: 41
Joined: Sun Jul 25, 2010 4:20 pm

Re: Image sequence texture in Luxblend25

Postby neo2068 » Tue Sep 06, 2011 12:25 am

mtoivo wrote:
J the Ninja wrote:Go for it, happy coding. :)

Thanks. I quickly browsed through the Image-objects propertys/methods, and couldn't find the "correct" filepath of the texture. Blender itself knows it, it is even displayed on the panel... I left a question to Blender's forums, hoping that the info is exposed to Python API. If it is, implementing sequenced texture support shouldn't be that big deal.

Hi!
I think that the current filepath isn't exposed in python. The initial path is stored in 'image.filepath' and the frame count and other parameter to get the current filename are stored in 'image_user'.

EDIT: I looked into the blender code and here is the source code for loading the image sequence. It uses the functions BLI_stringdec and BLI_stringenc to get the current filename.

Code: Select all
int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *numlen)
{
   unsigned short len, len2, lenlslash = 0, nums = 0, nume = 0;
   short i, found = 0;
   char *lslash = BLI_last_slash(string);
   len2 = len = strlen(string);
   if(lslash)
      lenlslash= (int)(lslash - string);

   while(len > lenlslash && string[--len] != '.') {};
   if(len == lenlslash && string[len] != '.') len = len2;

   for (i = len - 1; i >= lenlslash; i--) {
      if (isdigit(string[i])) {
         if (found){
            nums = i;
         }
         else{
            nume = i;
            nums = i;
            found = 1;
         }
      }
      else {
         if (found) break;
      }
   }
   if (found) {
      if (tail) strcpy(tail, &string[nume+1]);
      if (head) {
         strcpy(head,string);
         head[nums]=0;
      }
      if (numlen) *numlen = nume-nums+1;
      return ((int)atoi(&(string[nums])));
   }
   if (tail) strcpy(tail, string + len);
   if (head) {
      strncpy(head, string, len);
      head[len] = '\0';
   }
   if (numlen) *numlen=0;
   return 0;
}


void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic)
{
   char fmtstr[16]="";
   if(pic < 0) pic= 0;
   sprintf(fmtstr, "%%s%%.%dd%%s", numlen);
   sprintf(string, fmtstr, head, pic, tail);
}


static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
{
   struct ImBuf *ibuf;
   unsigned short numlen;
   char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX];
   int flag;
   
   /* XXX temp stuff? */
   if(ima->lastframe != frame)
      ima->tpageflag |= IMA_TPAGE_REFRESH;

   ima->lastframe= frame;
   BLI_strncpy(name, ima->name, sizeof(name));
   BLI_stringdec(name, head, tail, &numlen);
   BLI_stringenc(name, head, tail, numlen, frame);

   if(ima->id.lib)
      BLI_path_abs(name, ima->id.lib->filepath);
   else
      BLI_path_abs(name, G.main->name);
   
   flag= IB_rect|IB_multilayer;
   if(ima->flag & IMA_DO_PREMUL)
      flag |= IB_premul;

   /* read ibuf */
   ibuf = IMB_loadiffname(name, flag);
   if(G.f & G_DEBUG) printf("loaded %s\n", name);
   
   if (ibuf) {
#ifdef WITH_OPENEXR
      /* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
      if (ibuf->ftype==OPENEXR && ibuf->userdata) {
         image_create_multilayer(ima, ibuf, frame);   
         ima->type= IMA_TYPE_MULTILAYER;
         IMB_freeImBuf(ibuf);
         ibuf= NULL;
      }
      else {
         image_initialize_after_load(ima, ibuf);
         image_assign_ibuf(ima, ibuf, 0, frame);
      }
#else
      image_initialize_after_load(ima, ibuf);
      image_assign_ibuf(ima, ibuf, 0, frame);
#endif
   }
   else
      ima->ok= 0;
   
   if(iuser)
      iuser->ok= ima->ok;
   
   return ibuf;
}
i7 860, 16 GB RAM, NVIDIA Geforce GTX 560 + GTX 460, Windows 7 64bit, Blender 2.66
neo2068
Developer
 
Posts: 485
Joined: Sun May 03, 2009 2:11 am
Location: Germany

Re: Image sequence texture in Luxblend25

Postby mtoivo » Tue Sep 06, 2011 2:10 am

neo2068 wrote:I think that the current filepath isn't exposed in python. The initial path is stored in 'image.filepath' and the frame count and other parameter to get the current filename are stored in 'image_user'.

EDIT: I looked into the blender code and here is the source code for loading the image sequence. It uses the functions BLI_stringdec and BLI_stringenc to get the current filename.

Hi, and thanks for digging into this. It seems there is no way to get that info through python, which is a shame. In this situation, every exporter has to deal with sequence-textures themselves. I find it a bit hard to believe, but so it seems. It's not that hard to implement in python, just feels silly to rewrite the whole thing.
mtoivo
 
Posts: 41
Joined: Sun Jul 25, 2010 4:20 pm

Next

Return to LuxRender User Support

Who is online

Users browsing this forum: No registered users and 1 guest