I’m still learning panda3d while trying to build my first application with it.
My goal is to display (only display; any computation logic takes place outside of panda3d) lanes based on given boundary coordinates of two lines.
My problem is that I don’t know, where to start with that. I was reading the documentation for days now but it is quite a lot to take in.
I would be very thankful if anyone had some tips to start with, even if it’s just some pages of the documentation I should focus on and some short hints.
Well, how far have you gotten thus far?
If you’re still working on the basics of Panda3D, and haven’t done so already, you might go through the manual’s “hello world” tutorial–that should give you a decent start, I think.
The “hello world” tutorial should be available at this link.
If (or once) you’re relatively comfortable with the basics, then I might suggest looking at MeshDrawer as a potential means to draw your lanes–roughly speaking, it provides the means to generate some simple procedural geometry.
You should find information on that at this link.
Well, my application already contains different objects, so I would say that I already have learnt some basics but concerning geometry stuff there is still a lot to learn for me!
I already looked into MeshDrawer a bit but wasn’t sure if it can solve my problem. Thank you a lot!
Ah, my apologies–I thought that I recognised your user-name, but assumed that it was simply a similar one based on your first post in this thread. Sorry about that! ^^;
As to MeshDrawer… well, whether it’s suitable or not depends somewhat on the specifics of what you’re trying to do. For example, what do you want your lanes to look like? And what are the “boundary coordinates” of your lines?
You say that you’ve looked into MeshDrawer before, but weren’t sure of whether it could solve your problem–what was it that you wanted that MeshDrawer didn’t seem to do?
No worries, I still consider myself as beginner anyways
I would like to have the choice between dashed road markings and a continuous line and have a texture in between.
The boundary coordinates define the length of dashed lines (if it is a dashed line) and at the same time the sidewise boundary of the lane. Hence, there are coordinates every once in a while. One of my ideas was to define rectangles (with MeshDrawer) for the road texture and a line (maybe with MeshDrawers crossSegment) for the boundary lines.
I wasn’t sure if it was the most sensible option. I just read that it is used for UI stuff and wondered if thats the right choice then…
Oh wow no–I’ve used MeshDrawer for a variety of things!
Your idea for generating the road via MeshDrawer seems fine for the most part, I think.
You could also perhaps use a single texture that packs in the various combinations of the road with dashed- and solid- lines, and then use UV-coordinates (which can be specified to MeshDrawer) to pick the appropriate one for a given section of road.
Okay, perfect then. I will try my best with it now
I will try that! Seems like a good idea… Thank you a lot for your suggestions.
It’s my pleasure! I hope that implementation goes well.
I got my roads working quite well so far with the MeshDrawer! Thanks a lot again for your help, Thaumaturge!
The only problem I ran into is that shadows are not displayed on mesh objects as they are on the floor (generated with cardmaker). The shadows are generated by calling setShadowCaster on the respective light node. Is it possible to throw shadows on mesh-drawn geometry? I did not find any settings to activate that.
Hmm… I’m not sure. It’s possible that Meshdrawer-generated geometry lacks some component that the shadow-generation shader requires–but I may well be mistaken about that.
Thanks for the super quick reply!
What would be your suggestion for a similar alternative to the MeshDrawer then? It is quite important to display shadows on the road.
I’m still trying to find a solution for the MeshDrawer (I’ll post it here if I find sth) but if it does not work, I need to use something else
Well, bear in mind that I don’t know that MeshDrawer won’t take the default shadows–perhaps someone else will know a means!
As to other approaches, presuming that MeshDrawer does indeed not take the default shadows:
If your roads are fairly simple, and you could perhaps model the various potential segments of road that might be used, and then simply pick from those instead of generating your geometry on the fly.
Otherwise, you could perhaps construct the geometry yourself–see the manual, starting here.
And finally, you might be able to create your own shader, in which you implement shadow-casting in a way that works with MeshDrawer.
(And others may have further suggestions!)