Modo's 'Image Ink' feature

Hello !

I lately visited Modo 301’s website.
(I must say this is the software i’d be tempted to use if Blender didn’t exist.
But it exists !
So i don’t use Modo :D. )

On their rich website this video impressed me a lot.

Don’t you think this would be a nice addition to Blender ?
Do you think that such a thing is possible to make out of a python script ??? (At least in a general sort of way, not that smooth… Perhaps using the Bkground image ?)

I started to learn programming/scripting on my spare time 3 months ago, so this is waaaaaaaaaaayy out of my reach (my best achievments so far are in my signature…) but still i’d like to know if the API is capable of such a marvel !

If someone here has a good insight on python, can he/you tell me what you think ?
What kind of steps would you take to achieve that ?

I think this is a nice little feature: very very intuitive…

And if someone is tempted to try, can you contact me: i am dying to help !

Nice feature, but…

While blender does not have this feature exactly it has similar features via texture/vertex painting and the image editor, but still not exactly this feature so, I’m not 100% sure of the demand or need for something like this.

My first thought is: If you want to do this in python, learn C, familiarize yourself with the Blender Source and go for it there :spin:. The reason is that while I’m sure you probably could do this in python in some way, it’d be infinitely faster to teach yourself a new language and spend the time coding it there, since it would likely take longer to code this in Python than that.

That said, it would likely be possible in python. You’d need to use script links and learn to draw in the 3D view. If I remember correctly, prior to sculpt mode, there were python scripts (by a separate author than sculpt mode IIRC) that allowed sculpting and was somewhat similar to the tool set that would be required by this. Its on the wiki, called SculpMesh, and I think there was one that Campbell did as well.

You’d need to know 3D projections very, very well, since this is essentially retopoing an image onto a mesh. It would also likely get very very slow in python on dense meshes, which would be an advantage for it in C/C++.

A better way may be to add a more selective texture brush to the image editor, or even layers, since that would allow essentially the same features with mostly real-time updates, however this would likely require C/C++ as well.

So what I would likely do is this as a basic idea:
User Actions Pre Script: Take the mesh, assign UVs, have an Image in the Image editor

Enable Script
-Draw Image To Paint From(Perhaps have an easily editable/resizable plane with the image uv mapped? I don’t think background image information is available from python, although you could have a user manually enter it)
-Show Tools
-Return Control To User, start a loop:


      User Does action
      Script handles all the projection and mapping, ultimately drawing the pixels to the proper place in the image
      Return Control to User

***Done.

At least in that way its possible to come back or even have the image saved with the blend.

There is probably more I could say on this, but I need to defrag my brain right now :confused:, so if I think of something a little more useful and/or coherent, I’ll post.

Of course, I’m not the python guru.

Hello ForTe

While blender does not have this feature exactly it has similar features via texture/vertex painting and the image editor, but still not exactly this feature so, I’m not 100% sure of the demand or need for something like this.

Ohh… I didn’t know we had something similar. I will search for it :).

I 'd looooooove to be able to write something in C/C++ !
So you think it is a better option than doing it in python ? Interesting ! Trouble is i don’t have any experience with C/C++. Is it VERY different from python ? I have read that is it quicker, but it is because python has to be "translated " isn’t it ?

Until now i haven’t had any succes at compiling Blender for instance. It all look like black magic to me… A bit of scons, some mingw, some debugthingy and hop !
I don’t have any overview of the building process… What is what ? what happens? what are libraries ?

I had a look at the source code (here) but everytime i open a file it seems to me that i am looking to a “surface” code, that the real code is somewhere else…

Maybe you have some links ?

I like this challenge ! However i am faaaaaaaaaar from finished with learning python: i am unable to do anything outside the Blender API !
So i guess i should stick with it for now, what do you think ?

Does C have as many built-in fonctions as python ? I found that quite scary at first !

Thanks for your insight !

Yes, C is different and not so nice. (i’m not experience C coder)

I suggest, stay by python and learn programming and later go to C if needed.
Such scripts as your BigNumbersTools are surely good for your programming skills.

Python is not so performant like C, but handy, fast enough for many purposes and perfect for speed prototyping and concept testing. Good for learning different programing styles.

I’m very glad with “python & Blender”, cause it gives me interactive visual feedback e.g. helpful for 3d-vectors matrix processing. This way i don’t need abstract mathematic talent to solve many difficult 3d problems. It is my experience the last months with DXF-Importer script. :slight_smile:

migius

So you think it is a better option than doing it in python ? Interesting ! Trouble is i don’t have any experience with C/C++. Is it VERY different from python ? I have read that is it quicker, but it is because python has to be "translated " isn’t it ?

For this particular task, I would say that it is a better option to do it in C or C++ because the hooks into Blender and algorithms to get it to work would wind up being a little hacky and start to really tax the capabilities of the Python API and its speed.

C and C++ are similar to Python, but a whole lot more free. Basically in C they give you some syntax and say “Go Have Fun,” in C++ they give you some syntax, a lot of redundant, messy theory, and the STL and say “Go Have Fun.” They are a lot more free form than python, which is a large hurdle (you have to worry more about memory and CPU from the start, syntax errors in the code can translate to huge bugs, buffer overflows, other things that python tends to tuck away). They are definitely quicker than python at most things since they are compiled and python is dynamic, but a lot depends on the implementation of algorithms as well, since in some cases Python has run faster than C.

Does C have as many built-in fonctions as python ? I found that quite scary at first !

No, you have to code them all yourself (its part of the “fun” of C). For one list look here. For C++ look through some of the stuff here. C++ has more built in stuff you can use, so its marginally more pythonic.

Of course both are old enough now that they have lots and lots of external libraries available for them as well, which greatly extends their functionality. Whatever you need you can just google for a library to do it (some libraries/code is pretty bad, unsafe, and/or old, so you should do your research to prevent having bad stuff happen).

Until now i haven’t had any succes at compiling Blender for instance. It all look like black magic to me… A bit of scons, some mingw, some debugthingy and hop !
I don’t have any overview of the building process… What is what ? what happens? what are libraries ?

I had a look at the source code (here) but everytime i open a file it seems to me that i am looking to a “surface” code, that the real code is somewhere else…

Maybe you have some links ?

The build process is a little complex for a beginner, but it should be possible to get it going, check out some of the coding tutorials on the blender.org site, they have a compilation one IIRC.

The source code requires study. I don’t know all the internals of blender and how it works exactly, but in general when I want to study some source code I’ll use the CVS repository available at projects.blender.org and browse through online. Most of the source your probably looking for (the real “deep” internals) are going to be in the trunk/blender/source/blender, however I would strongly advise learning the structure and getting a feel for where stuff will be as that will help with compile errors and generally coding.

Libraries are external files that you can include. Think of them (for the time being) as modules in python.

like this challenge ! However i am faaaaaaaaaar from finished with learning python: i am unable to do anything outside the Blender API !
So i guess i should stick with it for now, what do you think ?

I think you should stick with Python since its a great language to get going with, and even do some real heavy duty work with (some of the BlenderDevs use Python to pre-code ideas even, I’ve heard). Expanding beyond the Blender API is definitely going to be beneficial since ultimately its going to help you back in the Blender API to have solved more “real world” problems.

Once you have some good experience and are starting to really find what you like programming, that’s when I’d switch over to C/C++ and start doing some power coding. Learning C/C++ is a good step, because then you start to understand how things like Python are coded and work (the python core is coded in C by the way). They are by no means absolutely required, but ultimately they do wind up being worth the effort you put into them.

Hello again !
First of all, thanks for your answers both of you !

@ migius: Yes i too think that i should stick with python for a little bit longer. My understanding is still very fragmental ! And i do lack mathematical training too…

@ ForTe: To me, C/C++ appears like THE pro language out of which everything is made. That makes it truely frightening !

about building: i’ve spent several hours today fiddling with scons, Tortoise etc… And while it still isn’t a succes (always some error on the way :mad:), at least i slowly get an overview.

I took another look into the SVN repository (thanks for the link !) but i feel like a middle-age lumberjack accidentally drop in present-day Tokio ! I don’t know where to find what i want to look at, and i don’t even know what i should look at !

Maybe you could recommend a good book starter book ?


Or maybe you are right i shall be reasonnable and try to master python some more before jumping into the deep-end ?!?

“Some real heavy duty work” : yep… I’ll search for a project to do next … Any ideas ?

Thanks fo your support !

Gwen

There are plenty of math trainers online if you need them.

To me, C/C++ appears like THE pro language out of which everything is made. That makes it truely frightening !

A lot of things are made out of C/C++, but a lot of that is just because they have always kind of been the standard between ultra-low level and high level programming. Other languages are just as capable as they are for the most part.

about building: i’ve spent several hours today fiddling with scons, Tortoise etc… And while it still isn’t a succes (always some error on the way :mad:), at least i slowly get an overview.

I took another look into the SVN repository (thanks for the link !) but i feel like a middle-age lumberjack accidentally drop in present-day Tokio ! I don’t know where to find what i want to look at, and i don’t even know what i should look at !

Yeah, compiling blender at first can be a little frustrating, but in the end its worth it. As for where you want to look it depends. If your talking about your specific problem (the Image Ink), your gonna need to be familiar with the 3D view, drawing methods, and Images as well. If your talking in general I would just start at the blender top directory and work my way down. The main stuff for blender is in intern/ and source/blender, so those are some good places to start.

Maybe you could recommend a good book starter book ?


Or maybe you are right i shall be reasonnable and try to master python some more before jumping into the deep-end ?!?

“Some real heavy duty work” : yep… I’ll search for a project to do next … Any ideas ?

For C, the “standard” is Kernighan and Ritchie which you can obtain an online version from UC Berkely here: http://inst.eecs.berkeley.edu/~cs61c/resources/knr/. There are plenty of other books, but be sure to avoid anything with a time in it (24 hours, 3 Days, 1 month, etc.) since these books teach you the example code, but nothing else really.

For C++, I used the C++ Primer by Lippman, Lajoie, Moo. Its a pretty standard text, but there are others as well.

In general, though, there is no replacement for actually coding stuff though.

I would definitely advise being as comfortable with Python as possible before diving into another language. While programming practices from other languages are going to help reinforce concepts in Python, they won’t be a replacement. Python is a good place to get a running start, but C/C++ will give you wings. For Blender Development its probably most important to know C at this point, but more and more is being rewritten in C++, so they are both eventually going to be important languages to know.

I myself have been dry on Python projects recently. A couple things coming to mind are things like:

Animation based off sound intensity (ala the visualizer in XYZ music player). There have been several scripts that animate based on sound, but in a lot of ways are kind of restrictive.

A good general exercise is to write a general purpose extrude function in python, and for that matter functions that are already in blender (not that this is really useful since its in blender, but it helps reinforce a lot of techniques).

I’m sure there are more, you just need some inspiration. I would say a good step would to be learn how to effectively use Object Oriented aspects with Blender scripting, if you haven’t already.

Thanks fo your support !

Thats what we’re here for! :D:ba::RocknRoll: