Jump to content

.obj Rendering Issues


Kwibble

Recommended Posts

So thanks to TheGreyGhost (I think it was), I have fixed the loading of my model ^-^

 

But Now it is... Well, rendering really... weird.

This first one is semi-correct. It renders part of it correctly.

https://onedrive.live.com/redir?resid=361B44D022EA75F6!174&authkey=!ABkCS2M6d5ywwyM&v=3&ithint=photo%2c.png

 

But then we come to this one... It's see through?

https://onedrive.live.com/redir?resid=361B44D022EA75F6!173&authkey=!ADi_EHb8CpaQLVA&v=3&ithint=photo%2c.png

 

Here is my renderer:

 

 

package com.example.examplemod;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.model.AdvancedModelLoader;

import net.minecraftforge.client.model.IModelCustom;

 

import org.lwjgl.opengl.GL11;

 

public class TileEntityTestRenderer extends TileEntitySpecialRenderer

{

private IModelCustom test;

private ResourceLocation modelLocation;

    private ResourceLocation testTexture;

 

    public TileEntityTestRenderer()

    {

    modelLocation = new ResourceLocation(Resources.MODID, "models/Test.obj");

        test = AdvancedModelLoader.loadModel(modelLocation);

        testTexture = new ResourceLocation(Resources.MODID, "textures/models/test.png");

    }

 

    @Override

    public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)

    {

        GL11.glPushMatrix();

        {

        GL11.glTranslated(x-0.5F, y, z-0.5F);

        bindTexture(testTexture);

            test.renderAll();

        }

        GL11.glPopMatrix();

    }

}

 

 

 

I think I am doing something wrong somewhere... Especially since the block is still being rendered :P So yeah... A tutorial link to this would be nice.

 

Any help is appreciated :)

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Link to comment
Share on other sites

Hi

 

When bits of my models disappear like this, it has usually been because back face culling has been turned on and some of my faces have been pointing the wrong way.

 

If you walk to the other side of your model (or inside ), can you see the faces from the other side?

 

If so, there's probably something wrong in your model or your export, so the faces are pointing the wrong way (some information on that here:

http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html

http://www.opengl.org/wiki/Face_Culling

)

 

If this is the problem, there are two ways to fix it

- fix the model, or

- turn off back face culling.  Since your shape is solid, you'll normally never see the inside, so this won't matter.

 

GL11.glPushAttrib(GL11.GL_ENABLE_BIT);  // save the settings

GL11.glDisable(GL11.GL_CULL_FACE);

// do your render stuff

GL11.glPopAttrib(); // restore the settings

 

-TGG

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Thanks TheGreyGhost.

 

I have also semi fixed some lighting issues... It's always the lighting issues...

 

Also - any ideas why I am still getting the block rendered in the middle there? I don't want it there and I am probably forgetting to tell it not to render it... Just not sure where.

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Link to comment
Share on other sites

@Alix_The_Alicorn Yeah, I found that soon after I answered >.>

 

@Eastonium In case you can't read, I had already solved the rendering problems... The lighting is a bit iffy now. Something like this:

https://onedrive.live.com/redir?resid=361B44D022EA75F6!175&authkey=!APkA9zR_1BIMM9w&v=3&ithint=photo%2c.png (NOTE: This was before I removed the sides rendering... Don't mind the block in the middle. The lighting is still the same without it)

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Link to comment
Share on other sites

@Helrato

Did you add this to your code:

@Override
public int getRenderType() {
	return -1;
}
        
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l){
	return false;
}

@Override
public boolean isOpaqueCube(){
	return false;
}

 

I think it's one of those functions you are missing, I do not understand how one of these might be influenced by your world gen type, though..

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



×
×
  • Create New...

Important Information

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