Simple LEvel Editor for Panda3D (WORKING!)

ok i might just be really stupid, so sorry before i ask if it’s just trivial but:

when i try to run main.py i get this error “IOError: cannot load model file(s): data/mesh80k.bam”

the thing is when i check my data folder, the file is actually there…
not sure where this leads me

Ok, that is strange.
Can you open the mesh80k.bam using pview?
The bam was made on 1.8, 32bit windows, maybe you are using some other os and version that can’t read that .bam file. I think there should also be a .egg version of that file, it will load a bit slower the first time but it should work just fine.

i was using panda-1.7.2, updated to 1.8.1 and it works fine (ps i m on windows 7, 64bit).
Thanks, i knew it was something really obvious , just could’nt put my finger on it :stuck_out_tongue:

The last few updates could break things for 1.8 as well, shadows, water and I’m not sure what else where made for the upcoming 1.9

I’ve done some updated to the demo (new water, some post-process filters), if someone, preferably with a (powerful) Nvidia card, could give it a shot and tell me how/if it runs then I’d be very grateful.

I have a GTX560Ti. Not that powerful but NVIDIA. =)
I got this error:

Known pipe types:
  glxGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
  File "main.py", line 1425, in <module>
    app=Editor()
  File "main.py", line 115, in __init__
    self.final_quad.setShader(Shader.load(Shader.SLGLSL, "shaders/fxaa_v.glsl", "shaders/fxaa_f.glsl"))
AttributeError: 'NoneType' object has no attribute 'setShader'

I can get the code to run if I replace

self.final_quad = manager.renderSceneInto(colortex=colorTex, auxtex=auxTex)

with:

self.final_quad = manager.renderSceneInto(colortex=colorTex)

The screen was black with some glitches.
On a side note I was having a error with the fxaa in the 09feb version. Then I just commented the fxaa code.
It seems the fxaa is more tied to the system now than the previous version - it’s not as easy to turn off)

If I comment the block of fxaa (114-121) I can run the code, but the terrain don’t show any textures (although grass appear normal).

I guess I have to enable the auxbit in some place, but don’t know why it works to you and not to me (I’m using the last commit of panda3d)

Looks like I’ve broken something :blush:
Can you try running the demo.py? Is it the same?

EDIT:
I think I got it fixed (it works on my end now). It’s a crude fix, and I need to disable the glare/flare on the cursor in the editor and also make the editor use the water from the demo (it’s so much better in my opinion)

Ok, I will try as soon as I restart in Linux. =)

Actually this line is still returning null.

final_quad = manager.renderSceneInto(colortex=colorTex, auxtex=auxTex)  

I don’t know why and cannot investigate now. If I remove auxtex param I get it to run but the result is psychedelic (probably fetching values from garbage in the shader).

I’ve just committed a patch that will disable filters if renderSceneInto with an auxtex returns None (you can also pass ‘fxaa_only=True’ to the setupFilters function to force this behavior).

The strange thing is that if I do turn off all the post-process filters (that’s 4 intermediate quads I render the scene into) the whole thing runs 10fps slower (a drop from 30-40 to 20-30fps). Can’t understand that.

A GTX560Ti should have no problems running the shaders, but maybe it’s the sRGB stuff added in the 1.9 (it bugged out and crashed on an intel HD), can you try commenting out loadPrcFileData(’’,‘framebuffer-srgb true’) and trying again?

It might be a different bug I saw someone run into; I’ve just checked in a fix to FilterManager for that.
github.com/panda3d/panda3d/comm … 5dff1ce112

Well the problem with the auxtex was solved with the fix rdb checked. =)
But, the terrain is still without texture. And the water filter seems to be affecting everything (not just the water plane).
I guess it have something to do with this thread: /viewtopic.php?f=4&t=17715

Anyway, I will just wait until you can finish those tests, so I can give a better feedback. :wink:

Oh. I found the problem with the terrain stuff.
It’s just in line 41 of the terrain_f.glsl. It should be

if (dot(p3d_ClipPlane[0], vpos) < 0.0)

instead of:

if (dot(p3d_ClipPlane[0], vpos) < 0) 

It’s sick, I know. But my driver cannot get it to compile, complain about

error C7011: implicit cast from "int" to "float"

I dunno but my driver seems to be lot more nitpicky, as I already had some problems with this kind of stuff and other people couldn’t be able reproduce (rdb, for instance, in the #version XXX redefinition case).

The driver I use is the NVIDIA-Linux-x86_64-346.35. My OS is Ubuntu 14.10. Dunno if it’ll help but anyway… =P

I’ve just committed an update.
The new things are:
-some water tweaks
-improved gui look
-3 texture grass
-some bugfixes

‘3 texture grass’ means that you can have 3 custom textures applied to the grass mesh(es), you can swap and load new ones at will and paint blends between them just like you would paint terrain textures (so you can have a place with 50% of tex1, 20% of tex2 and 30% of tex3). I’ve put 9 textures to the repo for a good start. It looks like this:

Code still where it was and will be:
github.com/wezu/koparka

There are some debug objects that are not meant to be used in the object painting mode (like a invisible sphere distorting the view), just ignore them :wink:

I hope I’ll have the time to add placeable lights (just point lights) and effects (both particle and animated billboards, using ‘soft-particles’) by the end of the weekend. These are the last features I wanted to add, and when that is done - the editor will also be done, and I will finally write a manual.

If someone has feature requests this is really the last moment to ask for them. So if anyone wants some features - now is the time to speak.

EDIT:
Oh, and there’s a video showin’ the new water
youtube.com/watch?v=Z2rhfgUE3u8

Hi. I’ve been using your editor for a while and will most probably use it as a level editor for my game. It’s really nice. Thank you for making it and sharing it, especially with all the included assets.

My Nvidia graphics card driver is rather strict concerning shader input types and I’ve had to change shader inputs quite often. Right now, I can’t even run your editor, but I’m confident I soon will be able to. But that’s beside the point.

I realize my feature requests are, umm, asking a lot, but here goes:

[]a cursor (and maybe keyboard shortcuts) for editable fields in the GUI (water level, props of assets …)[/]
[]custom map size. (doesn’t have to support rectangular) maybe by moving the omnipresent 512 to a config file and establishing a corresponding shader input?[/]
[]if not custom map size: some sort of scaling mechanism so the mesh+collision mesh remains at 512x512 but appears stretched/shrunk in the editor. textures can be painted and objects placed at “large” coordinates. [/]
[]only GLSL shaders. getting rid of the last Cg-shaders. [/]

Cheers -

Could you post what errors you get on the shaders? If you know what shader inputs or variables have a wrong format then listing them would help me a lot - I haven’t yet written a shader that worked the first time and most of the time I just try things untill it works more or less as I wanted it to work.

I think the cursor should be back if you use a newer p3d version.
What kind of shorcuts would you want? to jump fields? , to move the water level up and down? + to open the sky/sea panel and focus the cursor on the water z field?

The map size is a bit problematic. I think I can add a texture scale (number of tiles) and height scale, props can be scaled so I don’t think that’s a problem, but the grass … a few meshes would be needed- the grass tiles just don’t scale.
If the map was bigger then it would need even more polys, a tessellation
shader would solve this but that’s beyond my target hardware.

I forgot about the cg shaders, will get rid of them.

I’ve got the lights almost working, but the particles will need to wait for the next week

I have alleviated the shader issues with the help of heek on the panda IRC-channel.
I’d have prepared a pull request, but since you’re working on it right now, it might be easier this way:

player_f.glsl line 53: float spec = 0.0;
and the same goes for terrain_f line 127, default_f line 53, water2_f line 83.

terrain_w_f.glsl line 41: if (dot(p3d_ClipPlane[0], vpos) < 0.0)

Concerning the cursor: Interestingly it works in the properties field in the “Pickup placed objects” mode, but nowhere else. I’m using a quite recent Panda 1.9 build. That’s also where a shortcut for “Apply” like Ctrl+Enter (or something like that) might be nice.
Tab to jump fields would be great.

As I haven’t thought about the whole scaling thing thoroughly and even if I did I could probably not predict all requirements: Could you maybe implement the texture scale and height scale as you suggested them in a rudimentary manner. And kind of reduce the places with hardcoded 512?

P.S.: There are absolute paths in the campfire egg files.

A soon as I get a p3d version that has the cursor fixed (I’m on windows xp most of the time, can’t build from the git myself :blush: ) I’ll add a ‘tab to jump fields’ and I’ll think of shortcuts… and maybe also make the keys customizable with some config file.

And I think a config file is a good idea, I’ll get rid of all the hardcoded map/buffer/whatever sizes and read that from a config, so in the worst case even if some things won’t be configurable from within a running editor you’ll still be able to change them without having to change a number in 312 different places of the script. But the height/texture scale should be editable from the editor and saved with the map.

The campfire model (both of them) are just placeholders, I’m trying to finally make piece with Blender and that’s the first model I ever made, textured and exported with Blender (and that is a bit sad, giving the quality of the model). Just ignore it :mrgreen:

I think I fixed all the shader errors reported… but I probably added some new :mrgreen:

The new feature for today are point lights. They are hidden in the “Place objects” mode, under the “Place Collision Solids” tab. You place and scale them just like any other objects, but the hpr controls the color of the light (a bit stupid, but good for now). H=Red, P=Green, R=Blue. You can have up to 10 point lights, the number can be pumped up, but I don’t think it’s a good idea.

As a bonus, there’s an interesting fact - many people (on the internet) say to move as much code from the fragment to the vertex shaders, but for the grass shader there seams to be more vertex then fragments and for me the editor run 2x faster when I moved almost all the light calculations to the fragment shader. Almost makes me wish I could discard vertex… well not on my hardware.

And as usual, I’ve broken the demo :mrgreen:

Looks like, there’s at leas one more week of development.

I’m thinking about using this in an RPG I am working on. I have a few questions.
1 It runs 1 frame per second on my Mac. Any performance tweaks?
2 Any easy way to use it with bullet?

I killed performance with the few last updates, and I don’t know what to do ;(

I’ve almost got an update ready that will allow to turn some features on and off, so if you disable grass, point lights, shadows, use simpler water and maybe even drop terrain normal maps, then the editor will run ok on weaker hardware.
I only have to finish that… but I do have problems finishing anything for some time now, a bit of depression there.

Do you need some Bullet features in the editor or just in your game?
If the latter then just convert the collision nodes to bullet shapes, I made sure all collision geoms for models are under a node called ‘collision’ (or something like that) so it should be simple to convert them. You can do the same for the terrain collision mesh or use the height map -bullet can use a height map as a collision shape.

BTW I made an update to the sky, now there’s a sun there. Moves a bit fast and is not linked to the light, but it looks ok. Took me some time how to make uvs for the skydome.