Author Topic: Object3d switching/swapping in renderhook.  (Read 706 times)

Offline lawless_c

  • int
  • **
  • Posts: 91
    • View Profile
Object3d switching/swapping in renderhook.
« on: November 21, 2014, 06:32:03 pm »
Is there a standard way for quickly swapping out objects?

I'm thinking of making an addition to my game so that objects get swapped for very simple billboards at large distances.

If i can i get two benefits:

incredible distant objects can be made easily selectable.

Rendering very large quantities of objects will have less of an impact of rendering speed(I'm not really worried by this though as it hasn't been an issue so far).

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Object3d switching/swapping in renderhook.
« Reply #1 on: November 21, 2014, 08:49:59 pm »
There's no way use a renderhook for this. That's would be like selling your car while you are sitting inside of it. If you want to do that, just iterate through your objects and switch them. You might want to use some MVC approach for this, so that your actual object is decoubled from the view (complex or billboard). If that's not feasible, you might try to add the billboard as a child of the complex object and switch visibility of those two based on distance to the player.

Offline lawless_c

  • int
  • **
  • Posts: 91
    • View Profile
Re: Object3d switching/swapping in renderhook.
« Reply #2 on: November 24, 2014, 01:01:04 pm »
I could try the visibility/switching trick.

If an objects visibility is set to completely transparent though will JPCT still go through all the calculations of trying to render the objects mesh?


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Object3d switching/swapping in renderhook.
« Reply #3 on: November 24, 2014, 01:04:31 pm »
Yes, of course. What comes out of a transparent object depends on the shader. There's no way to tell that it will by really invisible.

Offline lawless_c

  • int
  • **
  • Posts: 91
    • View Profile
Re: Object3d switching/swapping in renderhook.
« Reply #4 on: November 24, 2014, 01:30:17 pm »
hmm ok, i'll iterating though at switching the references istead.