sidebar features
sidebar content

Go Back   Blender Artists Forums > General Forums > Python & Plugins

Closed Thread
 
Thread Tools
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
Checkout my site- its on the top until T release somthing new


http://members.iinet.net.au/~cpbarton/ideasman/
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#1   Old 25-Jul-05, 05:28   


monofoso monofoso is offline
Member
 
Join Date: Jul 2005
Posts: 82
Can you help me, i run the script i think i have everything done how it should be, the texture and so on but it doesnt seem to move can you please tell me how to use it properly im sure im ignoring an obvious solution.
............................................
Hooray
#2   Old 25-Jul-05, 08:06   
jms's Avatar
jms jms is offline
Member
 
Join Date: Mar 2002
Location: PACA, France
Posts: 3,527
What is the difference with the displacement map script that we can find on the makhuman site ?
............................................
Ze French Group : ZOO-Blender | Starter Kit Blender (livre en français)
Daily updated Bpy API | Ze best french tutorials site.
#3   Old 25-Jul-05, 08:29   
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
Quote:
Originally Posted by monofoso
Can you help me, i run the script i think i have everything done how it should be, the texture and so on but it doesnt seem to move can you please tell me how to use it properly im sure im ignoring an obvious solution.
You need to use a UV texture (add an image in face select mode)

For precedural displacement its not as usefull but is be fine for using existing image maps and using UV coords does give a lot of controle.

A possibility is to use vertex colours for displacement. Since its possible to write the current texture to the meshes Vert colours-
Python might even be able to automaticly but its not essential IMHO.

- Cam
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#4   Old 25-Jul-05, 11:14   
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
Quote:
Originally Posted by jms
What is the difference with the displacement map script that we can find on the makhuman site ?
I had a look at the make humen code- Mine is an improvement in a number of areas.

Make humen displacement is older and loads 1 ASCII, grayscale TGA for displacement - quite picky.
My script uses Blender new function to get the X/Y Colour of the pixel.
So its fairly WYSIWYG- any number of images are supported.

Other then that they do basicly the same thing, I can avoid TGA loading, mine uses mathutils for vector stuff, mine dosent rely on math not that that matters much anymore. I dont think make humens displacement script clamped the Coords.

I dont think makeHumen displacement can do anything mine cant.

Once thing Id like to add would be rgb -> xyz mabe do somthing tricky with alpha.
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#5   Old 25-Jul-05, 11:29   
jms's Avatar
jms jms is offline
Member
 
Join Date: Mar 2002
Location: PACA, France
Posts: 3,527
Does the [disp] texture option not work on uvmapped image ?
............................................
Ze French Group : ZOO-Blender | Starter Kit Blender (livre en français)
Daily updated Bpy API | Ze best french tutorials site.
#6   Old 25-Jul-05, 11:59   
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
[disp] texture works with UV's of course.

This is realy a modelling tool- my first blender project was to model a historic building.

Displacement mapping is limiting in some situations- Where you want to place tree's and buildings to fit terrain. or where you want greater controle.

At the time I did the displacement mapping I just used blenders Noise function with bumpmap to displace the verts (only planer projection) - But the function didnt allow you to type in values, I just kept clicking until it liked right, then I scaled a bit.
With my script you can define white as 5.4m high or whatever which in nice for height maps.


Here it is.





Also you cant make those groovy bubbles with [Disp]
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#7   Old 25-Jul-05, 15:53   
wah_tak's Avatar
wah_tak wah_tak is offline
Member
 
Join Date: Feb 2005
Location: Karlsruhe, Germany
Posts: 338
hey, cool.
I like the the recursive normal thing. It seems as if blenders disp mapping doesn't have the recursive thingy. It only calculates the normals once, and then moves the verts along them. (that way the mesh starts clipping itself)

EDIT (after trying it): Ahh.. i see now. it isn't really recursive. you just run the script multiple times.

Else I like it. I got some strange artifacts in the form of horizontal and vertical lines that were displaced too much or too little. I think thats because i forgot to turn of "snap to pixels" in the UV editor. (I did some "from window" UV mapping on a subdivided plane, so it wasn't scaled to the full image size)

Also you might like to add to your website, that the displacement map, ist a texture channel, but an image loaded into the UV editor. That took me a bit to find out.
............................................
http://www.wah-tak.net <-- my 3D-art page
#8   Old 25-Jul-05, 16:51   
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
I updated with some new features.

* Support for Procedural Textures!!!
* Automaticly use UV images/procedural textures or both
* Normaize Colour range to fit into min-max.
* Iterations set the the UI

4 metaballs and a procedural texture
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#9   Old 26-Jul-05, 05:44   
monofoso monofoso is offline
Member
 
Join Date: Jul 2005
Posts: 82
I got it! i tried it again and it worked thanks for the help
............................................
Hooray
#10   Old 26-Jul-05, 07:35   
broken's Avatar
broken broken is offline
Member
 
Join Date: Feb 2003
Location: Sydney, AU
Posts: 2,711
Would it be possible to hook this up to the onRender scriptlink to act like 'normal' displacement mapping that happens at render time?
............................................
web log
#11   Old 26-Jul-05, 08:49   
jms's Avatar
jms jms is offline
Member
 
Join Date: Mar 2002
Location: PACA, France
Posts: 3,527
Sorry but ...
As you can copy colors of the textures to the mesh 's vertex color when you enter in the vertex paint mode, or if you apply this code :

Code:
import Blender MESH=Blender.Object.GetSelected()[0].getData() MESH.update(0,0,1)
you can yet do all of this with the dispaint script, yet in the scripts bundle .

............................................
Ze French Group : ZOO-Blender | Starter Kit Blender (livre en français)
Daily updated Bpy API | Ze best french tutorials site.
#12   Old 26-Jul-05, 13:26   
lucidMonkey's Avatar
lucidMonkey lucidMonkey is offline
Donating Member
 
Join Date: Feb 2004
Location: Everywhere
Posts: 863
great script! i am a huge fan of your work and this is tops! double thanks for giving numerical control over max and min values of the image, perfect for height displacement maps!
............................................
Blend On!
#13   Old 26-Jul-05, 13:46   
macbuse's Avatar
macbuse macbuse is offline
Member
 
Join Date: Jan 2003
Location: TOULOUSE FRANCE
Posts: 147
Hi Cambo

I really like your script. I had a much easier time
following your code than with the bundled displacement
script . I guess you write a lot of Python code as you
use a lot of the Python idioms that are a pain for
people coming from Java etc. But in the end
it's worth it in readability and succinctness.


A minor Python style comment

if x!= None:

is just

if x:

and

if x == None:

is usually

if not x:


(I know there were some issues with this syntax with Blender
modules but I guess this is fixed now)
#14   Old 26-Jul-05, 14:22   
jms's Avatar
jms jms is offline
Member
 
Join Date: Mar 2002
Location: PACA, France
Posts: 3,527
[quote="jms"]Sorry but ...
As you can copy colors of the textures to the mesh 's vertex color when you enter in the vertex paint mode, or if you apply this code :

Code:
import Blender MESH=Blender.Object.GetSelected()[0].getData() MESH.update(0,0,1)
... but update(0,0,1) does not return good result for Map input : UV and
Material : Textface . Certainly a bug .
............................................
Ze French Group : ZOO-Blender | Starter Kit Blender (livre en français)
Daily updated Bpy API | Ze best french tutorials site.
#15   Old 26-Jul-05, 14:47   
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
Quote:
Originally Posted by macbuse
Hi Cambo

I really like your script. I had a much easier time
following your code than with the bundled displacement
script . I guess you write a lot of Python code as you
use a lot of the Python idioms that are a pain for
people coming from Java etc. But in the end
it's worth it in readability and succinctness.

.....

(I know there were some issues with this syntax with Blender
modules but I guess this is fixed now)
Hey macbuse, Im aware of all the the syntax's...
I obviously havnt settled on any.. but since you mention it I benchmarked some tests.

All tests were looped and tested 5000000 times

basicly -
z = 1
if z == None: # 1.6 sec
if not z: # 1.15 sec


So I dont think Ill use ... != None..

Sometimes I do it for readability,, Though "if x:" is nice and small it dosent realy give a hint as to what x is and makes the code a little more cryptic. but from now on Ill use that and just add the value of x as a comment.

Thanks for pulling me up on that one.

- Cam
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#16   Old 26-Jul-05, 22:45   
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
Quote:
Originally Posted by jms
Sorry but ...
As you can copy colors of the textures to the mesh 's vertex color when you enter in the vertex paint mode, or if you apply this code :

Code:
import Blender MESH=Blender.Object.GetSelected()[0].getData() MESH.update(0,0,1)
you can yet do all of this with the dispaint script, yet in the scripts bundle .

JMS- Your almost right-

First I didnt want to force the user to add vert colours to there mesh.

secondly, mesh.update(0,0,1) is buggy at the moment, going into edit mode from a mesh that has been generated from update(0,0,1) can segfault blender. see my report.
https://projects.blender.org/tracker..._id=9&atid=125
- So I dont actually want the user to have accsess to the evil vert colour mesh.

Thirdly - just adding vert colours isnt always good, since you may have lamps that cast light in the form of vert colours, my script backs up the material mode and temporarly turns the SHADLESS mode on each material used by the mesh.

BTW- I didnt know if your script, I dont count make humen since its old and uses a hackish/limited method of displacing though was very good for its time.

Not adding UV image's as colours is a good thing. if you want to light a mesh with vert colours and that mesh happens to have a UV Image, then it would give un-desired results.

If you wanted to write a UV image to vert colours then It would he farily simple to make a temporary image texture that would write to the vert colours just like precedural textures do. though you would need to split the mesh up if you had more then 16 images per mesh.
So all things considered I thing that getting the pixel location for the UV coord is an acceptable way of doing this at the moment.
Both work at the some time anyhow-

- Cam
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#17   Old 26-Jul-05, 23:01   
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
Quote:
Originally Posted by broken
Would it be possible to hook this up to the onRender scriptlink to act like 'normal' displacement mapping that happens at render time?
Yep I could do it- though there are some complications.
so its probably only worth adding for animations since the time it takes to generate the mesh is a bit of a waist for every render (test renders etc)...

Youd need start by backing up the mesh in a temporary scene since meshes with no users will always loose links the their materials.
(Another option would be to write a text file with materials used by each mesh, could even refine to make sure it only does this for single user meshes)
- Fake user accsess in python would be nicer though....

...so mesh data is backed up. you could distort the mesh, render and and restore the data.... no big deal. just a bit of a fiddle to back up the mesh.

Will look into it later, Im interested in making bubbles while animating texture coords
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#18   Old 26-Jul-05, 23:12   
NeOmega's Avatar
NeOmega NeOmega is offline
Donating Member
 
Join Date: Jul 2004
Location: Seattle, Wa
Posts: 1,237
OH wow, I decide to visit your site today, and I find an improvement ot one of my favorite tools!

Now I don't have to do all that gimp work of saving as an uncompressed tga!

Excellent.
............................................

#19   Old 27-Jul-05, 00:55   
macbuse's Avatar
macbuse macbuse is offline
Member
 
Join Date: Jan 2003
Location: TOULOUSE FRANCE
Posts: 147
I actually find the

Code:
if x:
more readable .

The speed thing I don't care about in
general. You just buy a faster PC every
12 months or so.

I was almost sure that you knew the idioms
but there are a lot of people out there who
don't. It's a pain in the a** to read some
scripts that are written with Java/C idioms.
Especially if you want to mod the script
for personal use.

BTW I notice you use enumerate().
I think this is aesthetically good but when
I rewrote the subsurface scattering script
using enumerate

http://www.dedalo-3d.com/index.php?f...ng_python.html

I had some negative performance issues
compared with just using

for i in range():
x[i]

But then again I don't care about speed (within reason)
#20   Old 27-Jul-05, 06:20   
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 15:44.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Logo and website design copyright © 2006 by froodee design bureau. All rights reserved.
Blender Headlines
Featured Artwork
Crocodile by Julia Korbut
Classic vintage look renders by HANGAR
Blending life - Old George by bigbad
Other Blender Sites
new icon Blender Homepage »
The official Blender homepage
new icon BlenderNation »
Fresh Blender News, Every Day
new icon Blenderart Magazine »
Blender articles, tutorials and images.
Social BlenderArtists