PDA

View Full Version : Gradient of color


Eugene
11-16-2016, 02:15 PM
Hi, I'm trying to create a gradient shade for a sphere with alpha(0.1). May I know how can it be done in vizard? Currently, the shade is constant throughout the sphere.

My objective is to create a blue atmosphere around the earth that is darker on both ends.

Alternatively, I'm also trying to generate a glowing effect around the earth to improve but not sure how can I do it. Appreciate your advice.

The Earth object is a OSGB file created in 3ds Max.

code:

import viz
import vizshape
import vizfx

viz.setMultiSample(8)
viz.fov(60)
viz.go()

earth = viz.addChild('earth.osgb')
earth.setScale(0.01,0.01,0.01)
earth.setPosition(0,1,0)
earth.addAction( vizact.spin(0,1,0,20) )
vizfx.addDirectionalLight(euler=(-45,90,45), color=viz.WHITE)


earthAT = vizshape.addSphere(radius=2.2,slices=60,stacks=60, axis=vizshape.AXIS_Y)
earthAT.setPosition([0, 1, 0])
earthAT.color(viz.AZURE)
earthAT.alpha(0.15)


Thank you.

Jeff
11-16-2016, 05:19 PM
If you have the source file and 3ds Max you can create these effects using shaders (http://docs.worldviz.com/vizard/#Shaders_3DS_Max.htm). A light map is used to add shadows and light to a model. The emissive effect simulates glow emitted from the model.

If you don't have the source model try loading the model into Inspector and experiment with the positioning of directional or spot lights (create > light). To see the effects of the custom lights without the default headlight go to view > lighting and turn lighting off. To change the ambient color go to the view > colors menu. In Vizard, use the following to add your model with saved lights and disable the ambient light:

earth = vizfx.addChild('earth.osgb')
vizfx.setAmbientColor(viz.BLACK)

See the lighting effects (http://docs.worldviz.com/vizard/#Effect_Lighting.htm) page for more on lighting.