Demomaster application framework with wxpython navigator


#121

great to know about that, thanks.


#122

Most of the stuff works fine in 1.7.0.


#123

I have not tried it out yet. Thank you for your test!


#124

I’ve written a simple fog shader using post-processing technique. Get it at:

code.google.com/p/pandademomaster/downloads/list

demo_fog.zip, it is an add-on to the demomaster

It is not working in version 1.7.0. My machine is still at version 1.6.2 so I am not able to tell you how to fix it on 1.7.0.

I believe the DOF demo (and shadow demos) is also broken if the depth buffer is not working as told.


#125

I’m attempting to add the sun shader in my own program. However when I do so I get this:

The sun looks normal when it is in the lower left corner. What am I doing wrong? :frowning:


#126

Can you post your code ?


#127

Yes! Sorry! I should be forbidden from posting late at night.

# -*- coding: utf-8 -*-
# sun only
title='sun'
from pandac.PandaModules import loadPrcFileData
loadPrcFileData( '', 'frame-rate-meter-scale 0.035' )
loadPrcFileData( '', 'frame-rate-meter-side-margin 0.1' )
loadPrcFileData( '', 'show-frame-rate-meter 1' )
loadPrcFileData( '', 'window-title '+title )
loadPrcFileData('', "sync-video 0")
loadPrcFileData('', "basic-shaders-only #f")

from direct.directbase.DirectStart import *
from panda3d.core import Vec3, Point3
from panda3d.core import PointLight, VBase4
from panda3d.core import NodePath
from direct.showbase import DirectObject
# This is for the sun shader
from direct.filter.CommonFilters import CommonFilters

base.setBackgroundColor(0, 0, 0) 
base.disableMouse() 
base.camera.setPos(0,-10,0)

def timer(task):
    sun.setShaderInput("time", task.time)
    return task.cont

sun2 = loader.loadModel("sphere")
sun2.reparentTo(render)
sun2.setScale(0.9)

# Check video card capabilities.
filters = None

filters = CommonFilters(base.win, base.cam)
#filters.setVolumetricLighting(sun2,32,0.5,1.0,0.05)
filters.setVolumetricLighting(sun2,32,0.7,0.99,0.05)


sun = loader.loadModel("sphere")
sun.reparentTo(render)
tex1 = [
    loader.loadTexture("sunlayer1.png"),
    loader.loadTexture("sunlayer1n.png"),
]
tex2 = [
    loader.loadTexture("sunlayer2.png"),
    loader.loadTexture("sunlayer2n.png")
]
index1 = 0
index2 = 0

tex3 = loader.loadTexture("FireGradient.png")
sun.setShaderInput("tex1", tex1[0])
sun.setShaderInput("tex2", tex2[0])
sun.setShaderInput("fire", tex3)
shader = loader.loadShader("sun.sha")
sun.setShader(shader)
taskMgr.add(timer, "timer")


run()

#128

Add this line will fix the problem:
loadPrcFileData("", “textures-power-2 none”)


#129

Awesome. Thankyou sir.


#130

I tried to recreate the show Panda shaders with the exact same sphere-tbn.egg and same textures you used and the difference is huge:
On the left my code and demomaster on the right.

Normal map is not being applied, there’s bloom everywhere and specially there’s some weird lines on the top and the right of the screen.
Do you know what am I missing ?

import direct.directbase.DirectStart 
from pandac.PandaModules import *
from direct.filter.CommonFilters import CommonFilters
from direct.showbase.DirectObject import DirectObject


class  Start(DirectObject):
	def __init__(self):		
		self.accept("space", self.toggleGlow)
		self.accept("b", self.boggleGlow)
		
		base.setBackgroundColor(0,0,0)
		plightCenter = NodePath( 'plightCenter' )
		plightCenter.reparentTo( render )
		self.interval = plightCenter.hprInterval(12, Vec3(360, 0, 0))
		self.interval.loop()
		
		plight = PointLight('plight')
		plight.setColor(VBase4(0.8, 0.8, 0.8, 1))
		plight.setAttenuation(Vec3(1,0,0))
		plnp = plightCenter.attachNewNode(plight)
		plnp.setPos(5, 5, 10)
		render.setLight(plnp)
		
		alight = AmbientLight('alight')
		alight.setColor(VBase4(0,0,0, 1))
		alnp = render.attachNewNode(alight)
		render.setLight(alnp)

		smiley= loader.loadModel('smiley.egg')
		smiley.reparentTo(plnp)
		
		self.glowSize=0
		self.filters = CommonFilters(base.win, base.cam)
		self.filters.setBloom(blend=(1,0,0,1),mintrigger=.6, maxtrigger=1, desat=-.5,intensity=3,size=1)
		self.LoadModels()
		#self.filters.setCartoonInk()
		#self.filters.setVolumetricLighting(plnp)
		
	def LoadModels(self):
		models = list()
		effects = [ 'diffuse', 'normal', 'gloss', 'glossModulate', 'glow', 'glowModulate' ]
		for x in xrange( 0, 64 ):
			mdl = loader.loadModel( 'sphere-tbn.egg' )
			mdl.setTwoSided( True )
			pX = x%8
			pY = x//8

			pos = Vec3( pX*3 - 10, pY*3 - 8, 0 )
			mdl.setPos( pos )

			s = mdl.getBounds().getRadius()
			mdl.setScale( 1./s*1.4 )

			txt = '%i/%i' % (pX, pY)

			efId = effects.index('diffuse')
			if x & 2**efId:
				tex = loader.loadTexture( 'Tex/diffusemap.png' )
				ts = TextureStage('ts')
				ts.setMode(TextureStage.MModulate)
				mdl.setTexture(tex, 1)
				txt += " diffuse"

			efId = effects.index('normal')
			if x & 2**efId:
				tex = loader.loadTexture( 'Tex/normalmap.png' )
				ts = TextureStage('ts')
				ts.setMode(TextureStage.MNormal)
				mdl.setTexture(ts, tex)
				txt += " normal"

			efId = effects.index('gloss')
			if x & 2**efId:
				tex = loader.loadTexture( 'Tex/glossmap.png' )
				ts = TextureStage('ts')
				ts.setMode(TextureStage.MGloss)
				mdl.setTexture(ts, tex)
				txt += " gloss"

			efId = effects.index('glossModulate')
			if x & 2**efId:
				tex = loader.loadTexture( 'Tex/glossmap.png' )
				ts = TextureStage('ts')
				ts.setMode(TextureStage.MModulateGloss)
				mdl.setTexture(ts, tex)
				txt += " glossMod"

			efId = effects.index('glow')
			if x & 2**efId:
				tex = loader.loadTexture( 'Tex/glowmap.png' )
				ts = TextureStage('ts')
				ts.setMode(TextureStage.MGlow)
				mdl.setTexture(ts, tex)
				txt += " glow"

			efId = effects.index('glowModulate')
			if x & 2**efId:
				tex = loader.loadTexture( 'Tex/glowmap.png' )
				ts = TextureStage('ts')
				ts.setMode(TextureStage.MModulateGlow)
				mdl.setTexture(ts, tex)
				txt += " glowMod"

			valid = True

			# it's not valid to have gloss and glossmodulate active at once
			efId1 = effects.index('gloss')
			efId2 = effects.index('glossModulate')
			if (x & 2**efId1) and (x & 2**efId2):
				valid = False
			# it's not valid to have glow and glowmodulate active at once
			efId1 = effects.index('glow')
			efId2 = effects.index('glowModulate')
			if (x & 2**efId1) and (x & 2**efId2):
				valid = False
			# dont show models with invalid texture mixings
			if valid:
				mdl.reparentTo( render )
				text = TextNode('node name')
				text.setTextColor(1, 1, 1, 1)
				text.setText(txt)
				tNode = render.attachNewNode(text)
				tNode.setPos( pos + Vec3(0,1.1,0) )
				tNode.setScale( 0.1 )
				tNode.setHpr(0,-90,0)
				tNode.setShaderOff()
				tNode.setLightOff()
		
	def toggleGlow(self):
		self.glowSize += .1 
		print self.glowSize
		if (self.glowSize == 4): self.glowSize = 0
		self.filters.setBloom(blend=(0,self.glowSize,0,0) ,desat=-2, intensity=3, size='medium')
		
	def boggleGlow(self):
		self.glowSize -= .1
		print self.glowSize
		if (self.glowSize == 4): self.glowSize = 0
		self.filters.setBloom(blend=(0,self.glowSize,0,0) , desat=-2, intensity=3.0, size='medium')
			
	
Start()
run()

#131

I think you have to turn auto shader on.


#132

Indeed, forgot that line.
Do you also get these white lines if you run my code ?


#133

What white lines are you referring to ?
May be you are talking about the text you have set as the title for each sphere. They are TextNode and you can see the text if you zoom in a bit.


#134

On the top of the window as on it’s right, you can see two white/grey lines which doesn’t appear with demomaster but shows up with my code.
The apparence of these two lines changes when I resize the window.
Here’s an other screenshot:


#135

I tried the demos (v0.8) with recent build of the Panda SDK. Most of the demos crash with some .dylib error, Terminal just saying Bus Error.
Here’s one of many crash logs:
pastebin.com/sRPvczqz

This one should be from the cubemap ocean demo:
pastebin.com/e8Yp79cp


#136

tallmystcarpet, bloom is a post process, it effects the whole screen. Those lines are this bug: bugs.launchpad.net/panda3d/+bug/424640

Bradamante, I think those errors may be this bug: [Bus Error on Mac with IntelGMA 950)

I get the bus error on my mac that has that issue, but not on mine that does not have that issue.


#137

The aquarium which discussed here:
[Aquarium effects)
is finally available here: code.google.com/p/pandademomaster/downloads/list

It is far from the end-product that I would like to have. Especially the underwater effects are bad, the plants are bad, and I would like to use some more shaders in the static scene demo, so many incomplete items …. also if the fish eyes can be moved….

Unfortunately I am so busy on something else, I am afraid this little project is up to here. Have fun and play with the fishes, feed them and create bubbles with your mouse.


#138

I don’t know what you had in mind to achieve but just like this I say it is awesome - the fishes move so sweet and realistic and the environment is believable. To make it perfect need just to tweak the fog (fishes looks unaffected) and maybe it feels the lack of shadows but not much more I think.
great job Cheung, congrats and thankyou for share it!


#139

Running here with Panda3D 1.7.1, built from a CVS checkout on Linux. It all works great… absolutely fabulous contribution, love it!

Cheers,
Gary


#140

You need to comment lines 271,272 in demomain.py for it not to crash with Panda3D 1.8.0.