PDA

View Full Version : Sky blending...?? suggestions?


k_iwan
06-04-2007, 01:32 AM
Hi

I was just trying out a transitioning sky from morning to noon skybox, and apparently, the blending texture method does not work for skybox.

################################################## #
import viz

morningSky = viz.add(viz.ENVIRONMENT_MAP,'morning/morning.jpg')
noonSky = viz.add(viz.ENVIRONMENT_MAP,'noon/noon.jpg')
eveningSky = viz.add(viz.ENVIRONMENT_MAP,'evening/evening.jpg')
nightSky = viz.add(viz.ENVIRONMENT_MAP,'night/night.jpg')

skyDome = viz.add('skydome.dlc')
skyDome.texture(morningSky)
skyDome.texture(noonSky,'',1)
#skyDome.texture(eveningSky,'',2)
#skyDome.texture(nightSky,'',3)

blend = viz.add('multitexblend.fp')
skyDome.apply(blend)

blend.param(0,0)

slider = viz.add(viz.SLIDER)
slider.translate(0.5,0.1)


def myslider(obj,pos):
if obj == slider:
blend.param(0,pos)

viz.callback(viz.SLIDER_EVENT,myslider)

viz.go()
################################################## #

When I run it, all i get is black. If I take out the blending part, I can see my skies. So, I guess the only alternative is by generating a 360 panoramic images and apply it on a polygon sphere? Any suggestions? Did I do something wrong?

Kind Regards,
Iwan

farshizzo
06-04-2007, 09:46 AM
Hi,

The fragment program you are using was made for 2D textures, it will not work with cubemap textures. You can use the node.texblend command to get the blending to work. Here is a sample script:import viz
viz.go()

dome = viz.add('skydome.dlc')

tex1 = viz.add(viz.ENVIRONMENT_MAP,'sky.jpg')
tex2 = viz.add(viz.ENVIRONMENT_MAP,'townhall_L.jpg')

dome.texture(tex1)
dome.texture(tex2,unit=1)
dome.texblend(0,unit=1)

slider = viz.addSlider(pos=(0.5,0.1,0))

vizact.onslider(slider,dome.texblend,unit=1)

k_iwan
06-05-2007, 04:31 AM
Hi,

Thank you for the clarification! .texblend works like a charm!
I just need to add time and datetime python module and... ... I will have a nice working "virtual-sky" :D

Thank you for pointing me in the right direction!

Kind Regards,
Iwan