Jump to content

[1.18.2] Modify minecraft Fog effect to create a "toxic mist"


Socrate

Recommended Posts

Hi, i'm trying to create a sort of  toxic "mist" in minecraft wich will be cleared by a machine. To create my mist I modified minecraft RenderSystem using the setShaderFogStart and End and setShaderFogColor methods and the EntityViewRenderEvent from forge to update it. The final idea is to make the block create  a protective sphere where there is no toxic mist. What I've done from now is to apply the toxic fog effect to the player when he leaves a sphere i defined (center : 10 100 10 in the World, radius = 10 blocks ). Here is how it looks :

https://imgur.com/WdAhF3D (inside the sphere)

https://imgur.com/PcluWul (outside the sphere)

 

The reason why i'm posting here is because I have a problem that I can't solve : as you can see in the picture 1, when inside the fog clear zone the player can see clearly through the sphere's border wich makes no sens as the outsides of the sphere is supposed to be toxic. What I would like to do is to make the outside of the sphere look the same as when we are outside of it (I hope what I say makes sense, English is not my native language ), how can I achieve that ? Maybe modifing the fog center effect to be centered on the sphere center (10 100 10 ) instead of the player itself ? Is it possible ? Do you think about an another way accomplishing what i descibed ? 


I really hope what I said made sense and that I made a correct description of what i want to accomplish
Have a nice day !

 

 

Edited by Socrate
Link to comment
Share on other sites

  • Socrate changed the title to [1.18.2] Modify minecraft Fog effect to create a "toxic mist"

I don't know much about this, but I do know you can't use the fog for this.

The fog is designed to limit the player's view distance, e.g. if they are in lava or water, but mainly so the game doesn't have to draw all the way to "infinity".

This means all the fog rendering code is based on the distance to camera. It's an illusion, it's not based on something physically in the world at some position.

 

Spit balling:

I would guess you want something more like how clouds are drawn? But again these are partially an illusion.

They are procedurally generated rather than being physically in the world, but they are kind of drawn at a location.

You can use forge's RenderLevelLastEvent to draw over the world. Look at LevelRenderer.renderClouds() for how clouds are drawn.

 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

1 hour ago, diesieben07 said:

I think you need a combination of both. Fog for when the player is inside the mist and a custom rendered "thing" for when they are outside. You can probably use RenderLevelLastEvent for that or a BlockEntityRenderer.

Okay thank you :)  that's what I was thinking too, so I need a way to hide the zone where there is the fog (but not visible cause the player is not inside ) from the player outside of when he's outside of the fog ?
Could you explain a little bit more precisely how to use the RenderLevelLastEvent or the BlockEntityRender ?

Link to comment
Share on other sites

RenderLevelLastEvent is just an event like you used EntityViewRenderEvent.

The event is fired after all the other renderering has been done, use it to draw what you like.

BlockEntityRenderer is used to manually render block entities, like drawing a chest opening and closing. I don't know how it could be used for this?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

So if I understood correctly, I should create a new BlockEntity like a Foggy green block and set it on the surface of the sphere using RenderLevelLastEvent or BlockEntityRenderer ( to hide the outside of the protecting sphere ) ? And the green foggy block should be translucid but not transparent and make the player able to go trough it like a phantom block ?

Edited by Socrate
Link to comment
Share on other sites

20 hours ago, Socrate said:

So if I understood correctly, I should create a new BlockEntity like a Foggy green block

this is one option you have

20 hours ago, Socrate said:

and set it on the surface of the sphere using RenderLevelLastEvent or BlockEntityRenderer

no, RenderLevelLastEvent would be one of the other optins you have
inside the BlockEntityRenderer you need to render the stuff (sphere) you want

20 hours ago, Socrate said:

And the green foggy block should be translucid but not transparent and make the player able to go trough it like a phantom block ?

yeah if you want that the player can see the source of the sphere

Link to comment
Share on other sites

29 minutes ago, Luis_ST said:

this is one option you have

no, RenderLevelLastEvent would be one of the other optins you have
inside the BlockEntityRenderer you need to render the stuff (sphere) you want

yeah if you want that the player can see the source of the sphere

Okay thank you a lot for your help ! So either I create a BlockEntity and set it in a sphere shape using the BER or I use the RenderLevelLastEvent to draw something ? I don't really understand how the RenderLevelLastEvent

For you wich option is the best ?

Link to comment
Share on other sites

48 minutes ago, Socrate said:

Okay thank you a lot for your help ! So either I create a BlockEntity and set it in a sphere shape using the BER or I use the RenderLevelLastEvent to draw something ?

yeah

49 minutes ago, Socrate said:

I don't really understand how the RenderLevelLastEvent

not sure whats the question

50 minutes ago, Socrate said:

For you wich option is the best ?

depends on your purpose and which one you prefer

Link to comment
Share on other sites

Quote

I don't really understand how the RenderLevelLastEvent

For you wich option is the best ?

If you don't understand how RenderLevelLastEvent would be used, it probably means its not a good solution for your problem?

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I have the problem that when I have flares or blocks to build in my offhand, they seem to be assigned an NBT tag, so I can't stack them with other flares or blocks.  
    • Thank you that was this mod indeed, it tried to spawn a structure at spawn but since It was already generated he was not able to and so crashed the server lol. I was looking for mod during the pregen and added it just before the ram issue, thank you
    • I’m trying to make a mod that lets me put beacon beams through barrels for a mod pack I’m making but I don’t know what code to put and where to make this happen   (Forge 1.20.1)  
    • ---- Minecraft Crash Report ---- // My bad. Time: 2024-07-17 11:17:18 Description: Unexpected error java.lang.NullPointerException: Unexpected error     at com.google.common.collect.Iterators$6.transform(Iterators.java:829)     at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52)     at net.minecraft.class_2370.remap(class_2370.java:744)     at net.minecraft.class_2370.unmap(class_2370.java:875)     at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.unmap(RegistrySyncManager.java:368)     at net.minecraft.class_310.handler$bma000$fabric-registry-sync-v0$disconnectAfter(class_310.java:11691)     at net.minecraft.class_310.method_18096(class_310.java:2269)     at net.minecraft.class_8673.method_10839(class_8673.java:319)     at net.minecraft.class_2535.method_10768(class_2535.java:673)     at net.minecraft.class_636.method_2927(class_636.java:290)     at net.minecraft.class_310.method_1574(class_310.java:1908)     at net.minecraft.class_310.method_1523(class_310.java:1246)     at net.minecraft.class_310.method_1514(class_310.java:882)     at net.minecraft.client.main.Main.main(Main.java:256)     at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)     at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)     at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at com.google.common.collect.Iterators$6.transform(Iterators.java:829)     at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52)     at net.minecraft.class_2370.remap(class_2370.java:744)     at net.minecraft.class_2370.unmap(class_2370.java:875)     at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.unmap(RegistrySyncManager.java:368)     at net.minecraft.class_310.handler$bma000$fabric-registry-sync-v0$disconnectAfter(class_310.java:11691)     at net.minecraft.class_310.method_18096(class_310.java:2269)     at net.minecraft.class_8673.method_10839(class_8673.java:319)     at net.minecraft.class_2535.method_10768(class_2535.java:673)     at net.minecraft.class_636.method_2927(class_636.java:290) -- Uptime -- Details:     JVM uptime: 111.259s     Wall uptime: 70.335s     High-res time: 44.634s     Client ticks: 508 ticks / 25.400s Stacktrace:     at net.minecraft.class_310.method_1587(class_310.java:2501)     at net.minecraft.class_310.method_54580(class_310.java:949)     at net.minecraft.class_310.method_1514(class_310.java:905)     at net.minecraft.client.main.Main.main(Main.java:256)     at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)     at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)     at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) -- Last reload -- Details:     Reload number: 1     Reload reason: initial     Finished: Yes     Packs: vanilla, fabric, accessories, advanced-xray-fabric, appleskin, armoroftheages, auditory, balm-fabric, beautify, betterf3, betterthirdperson, biolith, bobby, bosses_of_mass_destruction, caffeineconfig, cardinal-components, cardinal-components-base, cardinal-components-block, cardinal-components-chunk, cardinal-components-entity, cardinal-components-item, cardinal-components-level, cardinal-components-scoreboard, cardinal-components-world, carryon, chipped, chunky, cinderscapes, cinderscapes-client, cinderscapes-common, cinderscapes-worldgen, cloth-config, comforts, conditional-mixin, cool_elytra, cratedelight, creativecore, creeperoverhaul, cristellib, croptopia, dramaticdoors, duckling, eatinganimationid, elytratrims, entity_texture_features, epherolib, explorerscompass, fabric-api, fabric-api-base, fabric-api-lookup-api-v1, fabric-biome-api-v1, fabric-block-api-v1, fabric-block-view-api-v2, fabric-blockrenderlayer-v1, fabric-client-tags-api-v1, fabric-command-api-v1, fabric-command-api-v2, fabric-commands-v0, fabric-content-registries-v0, fabric-convention-tags-v1, fabric-convention-tags-v2, fabric-crash-report-info-v1, fabric-data-attachment-api-v1, fabric-data-generation-api-v1, fabric-dimensions-v1, fabric-entity-events-v1, fabric-events-interaction-v0, fabric-game-rule-api-v1, fabric-item-api-v1, fabric-item-group-api-v1, fabric-key-binding-api-v1, fabric-keybindings-v0, fabric-language-kotlin, fabric-lifecycle-events-v1, fabric-loot-api-v2, fabric-loot-api-v3, fabric-message-api-v1, fabric-model-loading-api-v1, fabric-networking-api-v1, fabric-object-builder-api-v1, fabric-particles-v1, fabric-recipe-api-v1, fabric-registry-sync-v0, fabric-renderer-api-v1, fabric-renderer-indigo, fabric-renderer-registries-v1, fabric-rendering-data-attachment-v1, fabric-rendering-fluids-v1, fabric-rendering-v0, fabric-rendering-v1, fabric-resource-conditions-api-v1, fabric-resource-loader-v0, fabric-screen-api-v1, fabric-screen-handler-api-v1, fabric-sound-api-v1, fabric-transfer-api-v1, fabric-transitive-access-wideners-v1, fabricloader, forf, freecam, friendsandfoes, geocluster, glassential, glore, grassoverhaul, horizontal_glass_panes, infinity-cave, iris, jade, jamlib, jankson, libgui, mavapi, mavm, medieval_buildings, mes, midnightlib, mns, more_armor_trims, mostructures, mr_dungeons_andtavernsdeserttempleoverhaul, mr_dungeons_andtavernsendcastlestandalone, mr_dungeons_andtavernsjungletempleoverhaul, mr_dungeons_andtavernsnetherfortressoverhaul, mr_dungeons_andtavernsoceanmonumentoverhaul, mr_dungeons_andtavernswoodlandmansionoverhaul, mss, mvs, natures_spirit, necronomicon, new_slab_variants, nicer-skies, noisium, notenoughanimations, polymer-core, polymer-resource-pack, resourcefulconfig, simple_backpack, sodium, sodium-extra, sound_physics_remastered, spectrelib, status-effect-bars, stendhal, sulfurpotassiummod, terraform-biome-remapper-api-v1, terraform-shapes-api-v1, terraform-surfaces-api-v1, terraform-wood-api-v1, the_bumblezone, time_on_display, toggleableitemframes, toomanypaintings, travelersbackpack, trimeffects, universal-graves, utility_belt, variantbarrels, variantbeehives, variantbookshelves, variantcomposters, variantsandventures, visuality, waterframes, waxablecoral, waystones, xaerominimap, xaeroworldmap, yet_another_config_lib_v3, zoomify, minecraft:supporteatinganimation, file/Stay_True_1.21.zip, file/Better Cats v2.0 1.21.zip, file/Better Horses v2.0 1.21.zip, file/Torrezx-Bad_omen.zip, file/Torrezx-Sculk_power.zip, file/Torrezx-Warden_Power.zip, file/Torrezx-Heavy_core_tools.zip, file/waystones_1.21.zip  
    • Maybe an issue with spawnstructures_forge
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.