From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Summer of Code Proposal

Name

Ben Batt


Email

benbatt at gmail.com

Project Title

Modifier Stack Upgrade


Synopsis

The goal of this project is to improve Blender's modifier stack in two ways:

  • Making the API more flexible and removing restrictions such as the current inability to place certain modifiers after non-deforming modifiers
  • Adding some new modifiers: Autosmooth, UV Projection and Displacement.

Benefits to the Blender Community

This project will benefit the Blender community by providing a more useful and flexible modifier interface to users and programmers. Some constraints will be removed, giving more power to users. The new modifier types added will provide more functionality, increasing Blender's usefulness.


Deliverables

  • Upgrade of modifier stack
  • Upgrade of current modifiers to work with the new modifier stack
  • Autosmooth modifier
  • UV Projection modifier
  • Displacement modifier


Project Details

Modifier Stack Upgrade

Blender's current modifier stack is a very useful tool. However, it suffers from some constraints. The main constraint this project aims to remove is the "original data" constraint: some modifiers require the base object's original data and thus cannot be placed in the stack after any non-deforming modifiers. Another constraint is that many modifiers cannot be applied to curves (for some modifiers this may not make sense, but for others it would be useful).

The best approach to upgrading the modifier stack is still to be determined, but there are a few possibilities.

One approach would be to extend the DerivedMesh implementation (currently used to transfer data between modifiers) to maintain all the original data from the base mesh. This could be less work, but may not be the best solution, as DerivedMesh is used in many places - a more targeted solution could be better.

Another approach would be to create a new ModifierMesh data structure to hold intermediate data between modifiers. This structure could hold all the original data from the base mesh, and modifiers could perform shallow copies of any data which they did not change. The structure would need to keep track of which data was shallow copied and possibly provide for a mapping between the current ModifierMesh data and the original object data.

Current Modifier Upgrade

Along with upgrading the modifier stack, the currently implemented modifiers will also have to be upgraded to work with the new API. This will not be too large a job, as most of the internals can stay the same. If others are working on modifiers at the same time as this project is underway, I will be happy to assist them in using the new API.

New Modifiers

The new modifiers to be added as part of this project are Autosmooth, UV Projection, and Displacement.

The Autosmooth modifier will perform the same function as Blender's current Mesh Auto Smooth option (splitting appropriate vertices and recalculating normals to make edges sharper than a threshold angle appear sharp while the rest appear smooth), but the results will be visible in Blender's 3D view window without needing to perform a render. Additionally, the results will be available to Python scripts for exporting purposes, making this modifier very useful for 3D content creation. Other features to be added include the ability to mark edges as sharp, and the ability to select different vertex normal calculation methods. Once completed, this modifier could replace the Mesh Auto Smooth button altogether, removing unnecessary complexity from the render code.

The UV Projection modifier will change a mesh's UV coordinates by projecting them onto the mesh using the matrix of a helper object (as though the UV texture was projected onto the mesh by a slide projector located at the helper object's position). Among other things, this modifier would be very useful for texturing meshes with photographs, as the projection could provide perspective correction.

The Displacement modifier will use a texture to displace vertices of a mesh. The displacement could be simple (using the luminosity of the image to displace in a single axis or direction), or more complex (for example, using the R, G and B values of the image to displace vertices in the X, Y and Z directions respectively. This is similar to the "Displacement" texture mapping type, with the exception that the displaced geometry is visible in the 3D view and can be accessed by Python scripts, exported or further modified.


Project Schedule

The first stage of the project will be to upgrade the modifier stack API. This will involve a brief period of investigation to determine the best approach, followed by a design and implementation stage.

The second stage of the project will be to upgrade the old modifiers to use the new modifier stack. This will also be a good opportunity to test the new modifier stack API for completeness.

The third stage of the project will be to implement the new modifiers. This will also provide further feedback on the new API.

I anticipate the first and second stages taking around half of the project time, with the third stage taking the other half.

Bio

I am a final year Computer Science/Computer Systems Engineering double degree student at RMIT University in Melbourne, Australia. I have undertaken a number of computer graphics subjects as part of my studies, creating a simple 3D engine and using Blender to create content for it.

I have been interested in open source software for some time. I run Linux on my home PC and do most of my software development in that environment. I also dual-boot Windows so I can test cross-platform compatibility (this was useful in finding a bug when working on the Array modifier).

I have worked on two Blender programming projects: a Python-based exporter for the HPX format written in Python, and an Array modifier written in C (see http://mediawiki.blender.org/index.php/BlenderDev/ArrayModifier). I have begun work on an Autosmooth modifier, but this is currently on hold due to study commitments.

I am comfortable programming in C, C++ and Java (having used them throughout my university studies), and am familiar with Python. I have used Blender for simple modelling tasks and program testing, and have a basic grasp of the interface. Having programmed additions to Blender in both Python and C, I am reasonably familiar with Blender's internals, particularly the modifier code.

I am excited about getting more involved with Blender development. I find it very satisfying work, and look forward to being able to contribute more.