Wednesday, October 3, 2012

Oops...

I had actually created this blog sometime back and cooked a custom template. But with Blogger's recent transition to a new UI, this blog did not get ported to the new system (Partly because I was not apying attention to this blog for sometime). So I created a new blog with a better name and I will be posting updates over there from now onwards.

http://learningblender3dsoftware.blogspot.in

Tuesday, October 2, 2012

Python Infrastructure in Blender 2.5 and above

I have started to study the Python infrastructure upon which Blender functions. To begin with, I added few lines of python code in some package initializer files under 2.63\scripts\
import os
type, package, init = __file__.split(os.path.sep)[-3:]
print ("loading package (type {0}) {1} \n\t {2}".format(type, package, __file__))

Upon starting Blender, following was the result (printed in the system console)
loading package (type modules)  bpy  
D:\BLENDER\RC\blender-2.64-RC2-windows64\2.63\scripts\modules\bpy\__init__.py
loading package (type startup)  bl_operators  
D:\BLENDER\RC\blender-2.64-RC2-windows64\2.63\scripts\startup\bl_operators\__init__.py 
loading package (type modules)  bpy_extras  
D:\BLENDER\RC\blender-2.64-RC2-windows64\2.63\scripts\modules\bpy_extras\__init__.py 
loading package (type startup)  bl_ui  
D:\BLENDER\RC\blender-2.64-RC2-windows64\2.63\scripts\startup\bl_ui\__init__.py
After the trivial experiment out of the way, I went ahead with doing something fun: prepending and appending  custom draw functions to all the registered panel types in Blender. The code below was added inside the register function defined in bl_ui startup package. I also tried to get my head around the layout engine.
    def drawBefore(self, context):
        layout = self.layout
        row = layout.row()
        box = row.box()
        box.label(text="The class of this panel is "+self.bl_rna.name, icon='CONSOLE') 
  def drawAfter(self, context):
        contextType = self.bl_context.capitalize()
        DOCS = 'http://www.blender.org/documentation/blender_python_api_2_63_17'
        URL = "{0}/bpy.types.{1}.html".format(DOCS, contextType)
        box = self.layout.split(percentage=1).box()
        if contextType:
            aStr = "Learn more about {0} context".format(contextType)
            box.label(text=aStr, icon='TRIA_DOWN')
            row = box.split(percentage=.4)
            row.operator("wm.url_open", text=contextType, icon="HELP").url = URL
        else:
            box.label(text="NO bl_context", icon="SPEAKER")
 
    module = 'bpy.types'
    for rType in dir(eval(module)):
        if rType.find('_PT_') == -1:
            continue
        panel = eval("{0}.{1}".format(module, rType))
        panel.prepend(drawBefore)
        panel.append(drawAfter)
And upon launching Blender, this is what I see..


Meanwhile, I found a glaring bug and reported on the bugtracker

Downloading Blender Test Builds

Monday, July 11, 2011

Mini Project : Environment Lighting using HDRI

I worked on this project to create an image to commemorate the joining of the 400'th member on the Facebook that I moderate called Blender Knowledge Base.

Software Used: 

Blender 2.58a

Techniques used:
  • Shading
    • Glossy materials with ray traced reflections using the world map
  • Lighting
    • Sun light with atmosphere
    • Ambient Occlusion (Multiply mode)
    • Environment Lighting (Gather: Raytrace, Angular map)
Setup:

Blender Scene File


Rendered with only Direct Lighting (Sun light)


Rendered with only Environment Lighting (Angular mapped HDRI)


Added Ambient Occlusion (Multiply mode)


Turned on the Direct Lighting from Sun Lamp (With default atmosphere setting on)


Enabled Ray traced reflections


Glossy Reflections from the shader


Environment lighting without falloff


Environment lighting with falloff