[Soc-2005-dev] PyTexture

Ton Roosendaal ton at blender.org
Tue Jul 26 14:44:04 CEST 2005


Hi Tim,

As you might understand by now, I'm going over all SoC docs! So, thanks  
for the wiki page;
http://wiki.blender.org/bin/view.pl/Blenderdev/PyTexture

Here's my remarks:

- In Blender, the texture functions can return *3* types of  
information. You only mention the 'intensity' and 'normal', but there's  
also the 'color' (RGBA) option. Very important!

- For efficient coding of python textures, the API you'll use is  
important. I miss a reference to for example the Noise module, or the  
Math utils.

- Conformity requirements... I think you could strictly define  
requirements for future PyTexture scripters which modules are  
acceptable to be used. This is a recurring topic for python... it seems  
to be impossible to enforce a 'context' for scripts. That seduces  
scripters to create totally evil mixed up scripts, using all kinds of  
modules together that shouldn't be.
For example; a scripter could like to use the 'active object' as input  
for texture, or the mouse location, or whatever. All that stuff should  
be forbidden! :)
The "render context" is supposed to live entirely outside of any UI  
script.

- Related to this, you could think over this 'render context', and what  
'global' variables could be made accessible for users after all, this  
also for the future real shader API. It might be outside of the scope  
of this project, but still interesting!

- I don't understand the diagram really... the arrows denote what?

- The cacheing idea... you mention: "In any scene where the camera is  
not moving, the same texture coordinates are used for the view". I  
really doubt that... the texture coordinates are calculated by Blender  
on the fly, and depend on a load of variables, with the camera position  
only one of them. Don't get seduced too easily to implement a cache...  
I would suggest;

   - make sure the API used is fast (Noise, Math, etc)
   - do tests to find out where the bottleneck is. Is it the actual call  
to python?
   - Blender could also request to deliver an array of results, based on  
a
     pre-calculated set of texture coordinates.

-Ton-



------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Soc-2005-dev mailing list