![]() |
|
#1
|
|||
|
|||
|
Standard Texture setup
How do you apply a standard texture setup (diffuse, normal, specular) to a model in vizard? I know GLSL so I could write a shader (although the vizard documentation is unclear on a lot of things, e.g. how is the uv attribute/varying called? Or is it using the old gl_TexCoord?)
but I'm sure this is already integrated. Can I get a code example? I played around with vizfx.addMaterialEffect (which also isn't documented) but vizard would normally just use the diffuse texture and ignore the rest. Thanks in advance. |
|
#2
|
|||
|
|||
|
I'll check with a developer and get back to you.
|
|
#3
|
|||
|
|||
|
I think I got this to work:
Code:
import viz
import vizcam
import vizshape
import vizfx
from vizfx.effect.material import BaseMaterial, Diffuse, Specular, Bump
viz.setMultiSample(8)
viz.fov(60)
viz.go()
viz.MainView.getHeadLight().remove()
pivot_nav = vizcam.PivotNavigate()
pivot_nav.rotateUp(60)
pivot_nav.setDistance(1)
viz.cam.setHandler(pivot_nav)
light1 = vizfx.addDirectionalLight(euler = (45, 45, 0))
vizfx.setAmbientColor([0, 0, 0])
box = vizfx.addChild('basketball.osgb')
diffuse_map = viz.addTexture("pattern_66_diffuse.png")
diffuse_map.wrap(viz.WRAP_T, viz.REPEAT)
diffuse_map.wrap(viz.WRAP_S, viz.REPEAT)
normal_map = viz.addTexture("pattern_66_normal.png")
normal_map.wrap(viz.WRAP_T, viz.REPEAT)
normal_map.wrap(viz.WRAP_S, viz.REPEAT)
specular_map = viz.addTexture("pattern_66_specular.png")
specular_map.wrap(viz.WRAP_T, viz.REPEAT)
specular_map.wrap(viz.WRAP_S, viz.REPEAT)
material = vizfx.addMaterialEffect(
Diffuse(diffuse_map, 0), Bump(normal_map, 1), Specular(specular_map, 2)
)
box.apply(material)
I would still like to know if this is the intended way to do it
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Texture Coordinate Generation (TexGen) using Shader | goro | Vizard | 1 | 05-31-2013 01:44 AM |
| How to render a texture of the transparent object and then blur it | whj | Vizard | 1 | 09-25-2012 03:15 PM |
| Avatar texture swaping | sleiN13 | Vizard | 5 | 06-24-2011 12:48 AM |
| How to apply shader and render texture to an object | whj | Vizard | 0 | 04-23-2010 12:23 PM |
| Randomly and Continuously Change Avatar's Face Texture | Karla | Vizard | 4 | 08-22-2008 12:14 PM |