Facepunch / sbox-issues

177 stars 12 forks source link

Glass shader renders incorrectly unless renderer component is disabled and re-enabled #4265

Open Gmod4phun opened 11 months ago

Gmod4phun commented 11 months ago

Describe the bug

Some models don't render correctly until the renderer component is disabled and re-enabled after setting the model. Changing the model to something else and then to the one you want does not seem to fix it either, only reenabling the component does. In this case its a model with the glass shader, where the reflections dont work unless said steps are done.

https://github.com/Facepunch/sbox-issues/assets/5991682/17fe33f0-2118-4b22-966a-17c0a8011321

Once the model was correctly rendered, switching to another model and then back to previous one renders it correctly. However, after clearing the model to the empty default, and then selecting the new model again, it will render incorrectly until the component is re-enabled.

https://github.com/Facepunch/sbox-issues/assets/5991682/887e32ce-6b34-46e6-b630-2e2142d3eec5

To Reproduce

  1. Add a ModelRenderer component to a GameObject
  2. Pick a model that uses glass shader
  3. See broken reflections until you re-enable the component

Expected behavior

All models should render correctly without the need to disable and enable the model renderer component.

Media/Files

No response

Additional context

No response

Gmod4phun commented 11 months ago

After some more testing,I think it has something to do with the SceneObject flags not being set properly.