Jump to content

Recommended Posts

Posted

Hello community,

 

I'm pretty new to OpenGL and the Tesselator.

I have coded the following:

https://gist.github.com/ThexXTURBOXx/04eb325a7c90811e24b975ac94975634

I render layers there.

The light-value says, if the layer should glow or should not glow in the dark (ignore brightness, like in XyCraft).

But the layers, which should use Vanilla lightning are a little bit too dark. Any function(s) is/are missing.

 

Problem 2: In some angles, some layers don't render properly (see 2nd screenshot the ore on the left)

 

Thanks in advance :)

2017-06-01_14.34.23.png

2017-06-01_14.34.30.png

Bringing the best mod back alive! Our mod REFORGED!

Balkon's Weapons for 1.8: https://github.com/TheOnlySilverClaw/Reforged/releases

Posted (edited)

 

Minecraft.getMinecraft().entityRenderer.enableLightmap();

You are enabling it(even though it should aready be) but not doing anything with it at all. If you are going to work with the lightmap - do so, set it's coordinates.

  Reveal hidden contents

 

Your issue is that you are using too much GL and not enough tessellator.

tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX)

->

tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR)

And then you can simply have the lightmap coordinates in your VertexBuffer vertices.

 

Or even better use a FastTESR. It's format is BLOCK([3]f pos, [1]hex color, [2]f uv, [2]s lightmap) so it already has the format that is fine for your cause. That is the preferred solution as if you do it correctly(and it is pretty easy to do so) you will achieve exactly what you need without any need for GL calls at all and will gain a significant performance boost.

Edited by V0idWa1k3r
  • Like 3
Posted

I've explained how to use lightmap in this thread:

It is just x and y coordinates on the lightmap. You can return something like x : 240, y : 0 to achieve full glow effect or calculate it based on combined lightvalue as I've shown in the topic I've linked.

Additionally do not forget to override TileEntity::hasFastRenderer in your tile to make your FastTESR actually 'fast'

  • Like 1
Posted (edited)

Thanks again!

I followed the instructions and now there is something weird (I think because of the hasFastRenderer-function)...

I don't know, why it doesn't load my sprite (It's registered in the TextureStitchEvent.Pre-Event).

Well, it loaded my sprite - yes.

But there are Vanilla-items, too - is that correct?

https://gist.github.com/ThexXTURBOXx/6821938191f0f39f3300ff0cbc9ae60b

 

Also, when I look from south towards north (second screenshot), then the lightning is weird again.

 

Sorry, that I am so bad at programming with the tessellator and those things :(

2017-06-01_18.07.13.png

2017-06-01_18.07.33.png

Edited by ThexXTURBOXx

Bringing the best mod back alive! Our mod REFORGED!

Balkon's Weapons for 1.8: https://github.com/TheOnlySilverClaw/Reforged/releases

Posted (edited)

The texture issue means that your UVs are incorrect. The code you've provided is not enough to determine what exactly is wrong with them as they are obtained at TileEntityGlow's coordX/coordY/maxX/maxY which are apparently lists? I don't see how they are initialized and thus can't tell what is wrong.

Post your new code related to rendering so I can see what may be wrong with lightmap issues.

There are vanilla items since MC made the change where items/blocks atlases were merged into 1 texture.

Edited by V0idWa1k3r
  • Like 1
Posted

This seems weird, because, if I return "true" in the hasFastRenderer-function, then I have the weird issue I mentioned above.

If i return "false", then it works (besides od the bug with the light).

FastTESR: https://gist.github.com/ThexXTURBOXx/042210368d57c25ebb9244e1fb96b794

TileEntity: https://gist.github.com/ThexXTURBOXx/55a548d32c1e0994c2285abda4958dbd

Black Ore Block: https://gist.github.com/ThexXTURBOXx/88a383403d983686e5987958a4d76197

The sprite is in the screenshots

Don't wonder, if I am silly or stupid. This was the first mod I ever wrote (like 3 years ago) and I didn't change much code, so I will make a cleanup after this works.

2017-06-01_18.20.57.png

2017-06-01_18.21.02.png

block_sprite.png

Bringing the best mod back alive! Our mod REFORGED!

Balkon's Weapons for 1.8: https://github.com/TheOnlySilverClaw/Reforged/releases

Posted (edited)

https://gist.github.com/ThexXTURBOXx/042210368d57c25ebb9244e1fb96b794#file-with-glow-L32

You can't bind a texture using FastTESR, It already binds minecraft's texture atlas and re-binds it if necessary. Add your textures to the atlas, get their holder objects(TextureAtlasSprite) using any method you like (BlockModelDispatcher, custom caches, from the texture map directly) get the UVs of that object and render using them. The difference between a FastTESR and a normal one is that a normal TESR renders each tile separately, while FastTESR batches them together. FastTESR allows 1 draw invocation for any amount of tileentities which return true in hasFastRenderer which is very good for performance for obvious reasons. That comes at a cost of using the atlas texture only(which you can workaround by adding your own textures to it with either standart resourceloading process or forge events) and a loss of ability to manipulate GL states which is fine for the most part.

Yeah, looking at your code - you can't do that. You need to add your textures to the texture map and use their uv's. No custom texturemaps allowed for FastTESR. You can add your textures to the map by defining them in the blockstates/model or by adding them directly to the map with forge's TextureStitchEvent.Pre event. Any method works fine. The second one offers more flexibility though since you do not need to have that texture defined anywhere and you can get the reference to your TextureAtlasSprite right there and then.

https://gist.github.com/ThexXTURBOXx/042210368d57c25ebb9244e1fb96b794#file-with-glow-L23

Just get that blockpos from your tileentity with te.getPos(). No potential rounding errors with casting doubles to ints and no need to create a new blockpos object 12 times each frame

 

And obviously return true at te's hasFastRenderer. If you don't - there is no point in even having your TESR as a FastTESR

Edited by V0idWa1k3r
  • Like 1
Posted

You could just let the standart model system to render the stone texture and model itself so the lighting is applied for you and you do not need to play with lightmap and combined light values and then render your glow overlay with the FastTESR.

Or you could try to get the correct lightmap texture coordinates. You might need to get the combined light value for each side separately with offsets for that side, not sure on this one.

  • Like 1
Posted

Now the standard model system renders the stone layer.

The problem is, that the textures by me are on the same layer like the standard stone one, creating render issues.

I don't want the black/red/etc. ore-pieces to fly over the block, what could I do now?
The standard model system doesn't allow invisible rendering :(

Bringing the best mod back alive! Our mod REFORGED!

Balkon's Weapons for 1.8: https://github.com/TheOnlySilverClaw/Reforged/releases

Posted
  On 6/2/2017 at 11:03 AM, ThexXTURBOXx said:

The problem is, that the textures by me are on the same layer like the standard stone one, creating render issues.

Expand  

What issues? Z-fighting? You do know that you can simply offset your faces you render in your TESR, right?

  On 6/2/2017 at 11:03 AM, ThexXTURBOXx said:

I don't want the black/red/etc. ore-pieces to fly over the block, what could I do now?

Expand  

Define 'fly over'

  On 6/2/2017 at 11:03 AM, ThexXTURBOXx said:

The standard model system doesn't allow invisible rendering

Expand  

Define "invisible rendering".

If you are experiencing Z-fighting you can either offset your faces or provide the stone texture that has 100% alpha channel at pixels that are overlayed with your TESR.

  • Like 1
Posted

Yes, I mean Z fighting.

With "fly over" I mean the offset. I don't want to offset the textures, because it looks silly :D

How can I provide a stone texture with 100% alpha channel? I made the texture transparent at some places, but with the standard Model system, those places are white. :/

Bringing the best mod back alive! Our mod REFORGED!

Balkon's Weapons for 1.8: https://github.com/TheOnlySilverClaw/Reforged/releases

Posted
  On 6/2/2017 at 12:03 PM, ThexXTURBOXx said:

but with the standard Model system, those places are white.

Expand  

Block::getBlockLayer controls the pass your block is rendered at. SOLID is the first pass and that is what the method returns by default. Solid pass has no alpha enabled in it's GL states so it just renders whatever colorvalue is in the buffer(most likely the color that is on those texture pixels, as it exists even with 100% transparrency). 

CUTOUT_MIPPED and CUTOUT have alpha enabled but no blend enabled and they are rendered after the solid pass. They simply cut any transparency value to either be completely transparent or non-transparent. Hint - CUTOUT is what you want to return in your implementation of this method.

Finally the TRANSLUCENT pass is done after every other pass and it has blending enabled, thus it renders transparency with transcluency.

 

I mean, you should have thought "hmm, my block textures are semi-transparent, I wonder if Vanilla has something like that... Oh yea, the glass block! I better look at how that is done" but whatever ;)

  • Like 1
Posted (edited)

TESR and rendering of tiles in general has nothing to do with chunkloading. In fact nothing client-related has anything to do with chunk loading. Chunk render buffers generation is the only thing that the client affects but that is not chunk loading. That is you seing the blocks in the chunk. That however is pretty efficient to begin with, and TESR have nothing to do with it as they are rendered each frame from the data you provide(including FastTESRs, they are just batched together into 1 draw invocation per howevermanyyouhave instead of 1 draw invocation per tile). 

Look into your console - there may be a message like "Needed to grow BufferBuilder buffer...". Even if you see it though it will only result in a lagspike every time the buffer needs to be resized, which is... 1? 2? It is not something that happens frequently. 

If there is no such message then your TESR has nothing to do with the lag directly. Inspect your game with any profiling tool like VisualVM or something to see what exactly is slowing you down. VisualVM should be included in your jdk.

Edited by V0idWa1k3r
Posted
  On 6/2/2017 at 5:06 PM, V0idWa1k3r said:

In fact nothing client-related has anything to do with chunk loading.

Expand  

Already thought about that... :D

 

  On 6/2/2017 at 5:06 PM, V0idWa1k3r said:

If there is no such message then your TESR has nothing to do with the lag directly. Inspect your game with any profiling tool like VisualVM or something to see what exactly is slowing you down.

Expand  

Yes, there is no message, I will try to figure out, what's wrong ^^

Thank you very much again :)

Bringing the best mod back alive! Our mod REFORGED!

Balkon's Weapons for 1.8: https://github.com/TheOnlySilverClaw/Reforged/releases

Posted
  On 6/2/2017 at 4:55 PM, ThexXTURBOXx said:

One last question: Is there any way to speed up chunk loading?

Expand  

Are you generating "ore"? Is your generation algorithm triggering runaway worldgen? (If you employ WorldGenMinable then you should be ok)

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted
  On 6/2/2017 at 7:43 PM, jeffryfisher said:

Are you generating "ore"? Is your generation algorithm triggering runaway worldgen? (If you employ WorldGenMinable then you should be ok)

Expand  

Yes, I'm generating "ore" with the WorldGenMinable-class:

(I just hope, I am doing it right: https://gist.github.com/ThexXTURBOXx/c4ed6ab9920b2d9bddd75645c1df218a)

Bringing the best mod back alive! Our mod REFORGED!

Balkon's Weapons for 1.8: https://github.com/TheOnlySilverClaw/Reforged/releases

Posted (edited)

Ah, indeed, you are correct. WorldGenMinable only offsets the ores it generates based on the vein size but not the base point. Hmm, not sure how I got confused with that, my bad. In this case you would be fine with your previous code. Although you may just be experiencing too much worldgen in general - 75 tries per ore per chunk is quite a lot, considering that vanilla by default only has a maximum of 33 for it's very common andesite/diorite/granite... Well, to be fair that's not really a lot, but could still cause some issues, though unlikely

Edited by V0idWa1k3r

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 fight fires for a living, it's in my blood as a volunteer firefighter. But nothing could have prepared me for the fire that almost reduced my family's future to ashes. I had secretly accumulated $150,000 worth of Bitcoin over the years, intending to lock up my children's education and provide my wife with some leeway from our constant shift-work life. That was until a phishing attack struck me while I was out fighting a wildfire. The call had been on a hot afternoon. We were dashing to contain wildfires tearing across parched scrub lands. At such frantic moments, my phone pulsed with a security alert message from what looked like my Bitcoin wallet operator. Drenched with sweat, fatigue, and hyper adrenaline, I had clicked on the link and input my log-ins without questioning anything. I was tricked by hackers during my most vulnerable time. Hours later, returning to the station, I emptied my wallet. The harsh reality hit me with more force than any fire could ever have. My carefully saved safety net had vanished. My heart beat faster than the sirens. I felt as though I had failed my family. I explained my terror of burgers at our favorite local diner that evening to my friend. He leaned in close and whispered a single word: Digital Hack Recovery. He swore by their effectiveness, stating they worked miracles when his cousin had crypto stolen from him in a scam. I was skeptical old-school and desperate, so I called them. From the first call, their team treated me like family. They didn't only view figures; they viewed a husband and a father attempting to rectify a horrific error. They labored day and night, following stolen money through blockchain transactions like l detectives. Progress was made every day, translating intricate tech into fireman-speak. Ten days later, I got the call. “We recovered your Bitcoin.” I cried. Right there in the station, surrounded by smoke-stained gear, I let it all out. Relief. Gratitude. Hope they don't stop there. Knowing I worked in emergency services, Digital Hack Recovery offered to run an online security workshop for my entire fire department. They turned my disaster into a lesson that safeguarded my team. These folks don’t just recover wallets; they rebuild lives. They rebuilt mine. I fight fires for a living, it's in my blood as a volunteer firefighter. But nothing could have prepared me for the fire that almost reduced my family's future to ashes. I had secretly accumulated $150,000 worth of Bitcoin over the years, intending to lock up my children's education and provide my wife with some leeway from our constant shift-work life. That was until a phishing attack struck me while I was out fighting a wildfire. The call had been on a hot afternoon. We were dashing to contain wildfires tearing across parched scrub lands. At such frantic moments, my phone pulsed with a security alert message from what looked like my Bitcoin wallet operator. Drenched with sweat, fatigue, and hyper adrenaline, I had clicked on the link and input my log-ins without questioning anything. I was tricked by hackers during my most vulnerable time. Hours later, returning to the station, I emptied my wallet. The harsh reality hit me with more force than any fire could ever have. My carefully saved safety net had vanished. My heart beat faster than the sirens. I felt as though I had failed my family. I explained my terror of burgers at our favorite local diner that evening to my friend. He leaned in close and whispered a single word: Digital Hack Recovery. He swore by their effectiveness, stating they worked miracles when his cousin had crypto stolen from him in a scam. I was skeptical old-school and desperate, so I called them. From the first call, their team treated me like family. They didn't only view figures; they viewed a husband and a father attempting to rectify a horrific error. They labored day and night, following stolen money through blockchain transactions like l detectives. Progress was made every day, translating intricate tech into fireman-speak. Ten days later, I got the call. “We recovered your Bitcoin.” I cried. Right there in the station, surrounded by smoke-stained gear, I let it all out. Relief. Gratitude. Hope they don't stop there. Knowing I worked in emergency services, Digital Hack Recovery offered to run an online security workshop for my entire fire department. They turned my disaster into a lesson that safeguarded my team. These folks don’t just recover wallets; they rebuild lives. They rebuilt mine. Contact : Whats...App : +.1 .4 7.4.3 5.3.7 7..1.9 Website : https://       digitalhackrecovery.com     Mail:            digitalhackrecovery         @techie.       com 
    • I fight fires for a living, it's in my blood as a volunteer firefighter. But nothing could have prepared me for the fire that almost reduced my family's future to ashes. I had secretly accumulated $150,000 worth of Bitcoin over the years, intending to lock up my children's education and provide my wife with some leeway from our constant shift-work life. That was until a phishing attack struck me while I was out fighting a wildfire. The call had been on a hot afternoon. We were dashing to contain wildfires tearing across parched scrub lands. At such frantic moments, my phone pulsed with a security alert message from what looked like my Bitcoin wallet operator. Drenched with sweat, fatigue, and hyper adrenaline, I had clicked on the link and input my log-ins without questioning anything. I was tricked by hackers during my most vulnerable time. Hours later, returning to the station, I emptied my wallet. The harsh reality hit me with more force than any fire could ever have. My carefully saved safety net had vanished. My heart beat faster than the sirens. I felt as though I had failed my family. I explained my terror of burgers at our favorite local diner that evening to my friend. He leaned in close and whispered a single word: Digital Hack Recovery. He swore by their effectiveness, stating they worked miracles when his cousin had crypto stolen from him in a scam. I was skeptical old-school and desperate, so I called them. From the first call, their team treated me like family. They didn't only view figures; they viewed a husband and a father attempting to rectify a horrific error. They labored day and night, following stolen money through blockchain transactions like l detectives. Progress was made every day, translating intricate tech into fireman-speak. Ten days later, I got the call. “We recovered your Bitcoin.” I cried. Right there in the station, surrounded by smoke-stained gear, I let it all out. Relief. Gratitude. Hope they don't stop there. Knowing I worked in emergency services, Digital Hack Recovery offered to run an online security workshop for my entire fire department. They turned my disaster into a lesson that safeguarded my team. These folks don’t just recover wallets; they rebuild lives. They rebuilt mine. I fight fires for a living, it's in my blood as a volunteer firefighter. But nothing could have prepared me for the fire that almost reduced my family's future to ashes. I had secretly accumulated $150,000 worth of Bitcoin over the years, intending to lock up my children's education and provide my wife with some leeway from our constant shift-work life. That was until a phishing attack struck me while I was out fighting a wildfire. The call had been on a hot afternoon. We were dashing to contain wildfires tearing across parched scrub lands. At such frantic moments, my phone pulsed with a security alert message from what looked like my Bitcoin wallet operator. Drenched with sweat, fatigue, and hyper adrenaline, I had clicked on the link and input my log-ins without questioning anything. I was tricked by hackers during my most vulnerable time. Hours later, returning to the station, I emptied my wallet. The harsh reality hit me with more force than any fire could ever have. My carefully saved safety net had vanished. My heart beat faster than the sirens. I felt as though I had failed my family. I explained my terror of burgers at our favorite local diner that evening to my friend. He leaned in close and whispered a single word: Digital Hack Recovery. He swore by their effectiveness, stating they worked miracles when his cousin had crypto stolen from him in a scam. I was skeptical old-school and desperate, so I called them. From the first call, their team treated me like family. They didn't only view figures; they viewed a husband and a father attempting to rectify a horrific error. They labored day and night, following stolen money through blockchain transactions like l detectives. Progress was made every day, translating intricate tech into fireman-speak. Ten days later, I got the call. “We recovered your Bitcoin.” I cried. Right there in the station, surrounded by smoke-stained gear, I let it all out. Relief. Gratitude. Hope they don't stop there. Knowing I worked in emergency services, Digital Hack Recovery offered to run an online security workshop for my entire fire department. They turned my disaster into a lesson that safeguarded my team. These folks don’t just recover wallets; they rebuild lives. They rebuilt mine. Contact : Wh.ats.Ap.p : +1 .4 .7  4 3. 5  3  .7 7.1.9 Website : https://     digitalhackrecovery.   com Mail:       digitalhackrecovery     @         techie.                     com  
    • Ran it one more time just to check, and there's no errors this time on the log??? Log : https://mclo.gs/LnuaAiu I tried allocating more memory to the modpack, around 8000MB and it's still the same; stopping at "LOAD_REGISTRIES". Are some of the mods clashing, maybe? I have no clue what to do LOL
    • Tried removing some biome generation mods and test ran it again, but it's still the same; still not responding as soon as it gets to "LOAD_REGISTRIES". This time with more errors though. Log : https://mclo.gs/uygZzD8 Is there too little memory allocated to the modpack maybe? Can someone help please.    (T.T)💔
    • This is sad. Over 3300 people have checked the thread and no one is able to help or give any ideas :(.
  • Topics

×
×
  • Create New...

Important Information

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