Mon, Feb 10, 4:30 AM CST

Renderosity Forums / Blender



Welcome to the Blender Forum

Forum Moderators: Lobo3433 Forum Coordinators: LuxXeon

Blender F.A.Q (Last Updated: 2025 Feb 09 8:29 pm)

Welcome to the Blender Forum!


   Your place to learn about Blender, ask questions,
   exchange ideas, and interact with the other Blender users!


   Gallery | Freestuff | Tutorials

 

Visit the Renderosity MarketPlace. Your source for digital art content!

 





Subject: Subsurface Scattering Script.


Nicholas86 ( ) posted Wed, 12 January 2005 at 9:38 AM · edited Thu, 23 January 2025 at 5:02 PM

Attached Link: http://www.elysiun.com/forum/viewtopic.php?t=30101&highlight=render

A nice script if you want to read more about it. The attached link goes to some images. Pretty slick I think. And shows the power of scripting. Definetly think every program should have scripting capabilities. by shteeve from Elysiun: new to version 0.2: -restructured the way vertex data is managed... should give a large speed improvement -now operates on the currently selected mesh so you don't have to change any code (although it'll crash if you've got nothing selected) -provided a simple gui Blender import * import math scale = 0.01 falloff = 0.5 object = Object.GetSelected() mesh = object[0].getData() faces = mesh.faces vList = mesh.verts vInf = range(len(vList)) def event(evt, val): if evt == Draw.ESCKEY: Draw.Exit() return def button_event(evt): global scale, falloff if evt == 1: scale = B1.val elif evt == 2: falloff = B2.val elif evt == 3: time1 = sys.time() print "Gathering mesh data..." for faceNum in range(len(faces)): face = faces[faceNum] verts = face.v cols = face.col for vertNum in range(len(verts)): vert = verts[vertNum] col = cols[vertNum] for v in range(len(vList)): if vert.co[0] == vList[v].co[0] and vert.co[1] == vList[v].co[1] and vert.co[2] == vList[v].co[2]: if vInf[v] == v: vInf[v] = [[faceNum, vertNum]], col else: vInf[v][0].append([faceNum, vertNum]) if vInf[v][1].r < col.r: vInf[v][1].r = col.r if vInf[v][1].g < col.g: vInf[v][1].g = col.g if vInf[v][1].b < col.b: vInf[v][1].b = col.b print "Calculating..." factor = [] for x1 in range(len(vList)): v1 = vList[x1].co factor.append([]) for x2 in range(x1 + 1, len(vList)): v2 = vList[x2].co dist = pow(pow(v1[0]-v2[0], 2) + pow(v1[1]-v2[1], 2) + pow(v1[2]-v2[2], 2), falloff) if dist > 0: factor[x1].append(scale / dist) else: factor[x1].append(0) sss = [] for x1 in range(len(vList)): c1 = vInf[x1][1] sss.append(NMesh.Col(c1.r, c1.g, c1.b, c1.a)) for x2 in range(x1): c2 = vInf[x2][1] sss[x1].r = sss[x1].r + int(factor[x2][x1 - x2 - 1] * c2.r) sss[x1].g = sss[x1].g + int(factor[x2][x1 - x2 - 1] * c2.g) sss[x1].b = sss[x1].b + int(factor[x2][x1 - x2 - 1] * c2.b) for x2 in range(x1 + 1, len(vList)): c2 = vInf[x2][1] sss[x1].r = sss[x1].r + int(factor[x1][x2 - x1 - 1] * c2.r) sss[x1].g = sss[x1].g + int(factor[x1][x2 - x1 - 1] * c2.g) sss[x1].b = sss[x1].b + int(factor[x1][x2 - x1 - 1] * c2.b) for ref in range(len(vInf[x1][0])): mesh.faces[vInf[x1][0][ref][0]].col[vInf[x1][0][ref][1]] = sss[x1] mesh.update() Redraw() time2 = sys.time() print "calculation time: ", time2 - time1 def gui(): global B1, B2, B3 BGL.glClearColor(0.7, 0.7, 0.7, 1) BGL.glClear(BGL.GL_COLOR_BUFFER_BIT) BGL.glColor3f(0.75, 0.75, 0.75) BGL.glRecti(5, 5, 195, 55) BGL.glRecti(5, 60, 195, 115) BGL.glColor3f(0.65, 0.65, 0.65) BGL.glRecti(5, 115, 195, 135) BGL.glColor3f(1,1,1) BGL.glRasterPos2i(10, 122) Draw.Text("Effect Options") BGL.glRasterPos2i(10, 150) Draw.Text("SSS by shteeve") B1 = Draw.Number("Scale: ", 1, 10, 90, 180, 20, scale, 0.001, 1.0, "Intensity of effect (usually small numbers)") B2 = Draw.Number("Falloff: ", 2, 10, 65, 180, 20, falloff, 0.001, 1.0, "Falloff of effect") B3 = Draw.PushButton("Calculate!", 3, 10, 10, 180, 40, "Calculates effect.") Draw.Register(gui, event, button_event)


ysvry ( ) posted Thu, 13 January 2005 at 9:19 PM

i got an error runing it on my windows comp????

for some free stuff i made
and for almost daily fotos


ysvry ( ) posted Sun, 16 January 2005 at 3:56 AM

did anybody else try it ? maybe its just a typo?

for some free stuff i made
and for almost daily fotos


Nicholas86 ( ) posted Mon, 17 January 2005 at 5:34 PM

Did you double check the script from Elysiun, it could be I missed something.


ysvry ( ) posted Tue, 18 January 2005 at 12:57 PM

no didnt you try it yourself????plz post only working stuff.

for some free stuff i made
and for almost daily fotos


face_off ( ) posted Sun, 30 January 2005 at 8:59 PM

This is unlikely to work, since python relies on correct indenting (which is lost in these forum threads).

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.