Jump to content

[1.8] OBJ Model Lighting


ShetiPhian

Recommended Posts

My few other obj models are not full blocks so I'm just discovering the issue now.

 

Some of the faces on my models are using the opposite sides lighting.

 

 

I figure its something off in my model or code but am unsure what it is.

 

OBJ: http://pastebin.com/YBWTKmWQ

MTL:

newmtl mat_vault1
Ka 0.0 0.0 0.0
Kd 0.8 0.8 0.8
map_Ka multistorage:models/mat_vault1
map_Kd multistorage:models/mat_vault1

newmtl mat_vault2
Ka 0.0 0.0 0.0
Kd 0.8 0.8 0.8
map_Ka multistorage:models/mat_vault2
map_Kd multistorage:models/mat_vault2

 

Related Code:

// In Block
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
{
    OBJModel.OBJState newState;
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof TileEntityVaultDoor && state.getBlock() == this) {
        newState = new OBJModel.OBJState(((TileEntityVaultDoor)tile).getGroup(), true, ((TileEntityVaultDoor)tile).getTransform());
    } else {
        newState = new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true, new TRSRTransformation(TRSRTransformation.getMatrix(EnumFacing.NORTH)));
    }
    return ((IExtendedBlockState)state).withProperty(OBJModel.OBJProperty.instance, newState);
}

// In TileEntity
public TRSRTransformation getTransform()
{
    if (this.transform == null) {
        Matrix4f matrix = new Matrix4f(TRSRTransformation.getMatrix(this.direction));
        matrix.setScale(0.5F);
        matrix.setTranslation(new Vector3f(0.5F, 0.5F, 0.5F));
        this.transform = new TRSRTransformation(matrix);
    }
    return this.transform;
}

public List<String> getGroup()
{
    if (this.group.isEmpty()) {
        EnumDoorPart part = this.vaultDoorType;
        if (part == EnumDoorPart.CONTROLLER_2X || part == EnumDoorPart.FILLER_2X) {
            this.group.add("2x2_" + (this.doorSection + 1));
        } else if (part == EnumDoorPart.CONTROLLER_3X || part == EnumDoorPart.FILLER_3X) {
            this.group.add("3x3_" + (this.doorSection + 1));
        } else {
            return Lists.newArrayList(OBJModel.Group.ALL);
        }
    }
    return this.group;
}

 

Image of Issue:

width=800 height=337https://lh3.googleusercontent.com/s-6tuHnyLzzn7HYjaSAWQp-sETX9Yop8EaPTUNEkun5zfXybKeNnkfJlHXr2cV164zfg3fpqH8ovHqHJCnW_1E7zwJ54IGnmF37Uqa4vbQpODcF4ZRaEF38UpsJW36d29SAOqfoynASpUSUUtg2_6GXI7NL6cpYSCg6CoyrrvLK7Oh2cS5TYVt5baVFILkGMUL5WmnxdIFR8J61MlR8veRO3Fnnjrw7VwAnU2LymFKGUSuV-uvlqADYACVz2ZhH_IMBxCdV2a0LqkSJcxXSb6wP_OamxuOUV6Ga-V03aRCyn0Xt164KKILqYDCHn4dFdwSVzbgDOBcXr3df6yIfOFQQ5pY8eAb5z6MtoVaYkHkEGdQ_AprLC2UxOuSkExuTdLfTGJ5R3lvk2dqn1mUgT3n7SHNJbhBQR0HkRrT7WcjPksS375b0J5Ge7NMpw4_0x8oXf6xrNXGM_w_bSrrQrl1XCORm4T4gHrhi0fTwFbtXiIPvPi7xs1DarLf22uRlhMNQwn5VzRh2K8RN8sywtInj-qe4uitkYA_5MGThZL65A-aYkvbOGq1eMQ8PoAtnHTZ7O=w1631-h688-no[/img]

 

Columns:

Model Rotation; North, South, East, West

 

Rows:

Model's front with room behind unlit

Model's front with room behind lit up

Inside of unlit room looking at Model's back

 

In the first row the first and last (north and west rotations) are correctly lit, while some the on the other two are wrong.

In the last row the middle (south and east rotations) are correctly lit, while some the on the other two are wrong.

 

Some north faces are using south lighting, and some west faces are using east lighting.

Link to comment
Share on other sites

Thank you for the reminder, when I place the final texture on the block I'd be wondering why it was darker, then trying to recall how I fixed it on the other models :)

 

Unfortunately that only control's the brightness of the texture, not how the shadows are applied.

Turning off the games smooth lighting "fixes" the issue.

So something is causing the shader to think the faces are on the opposite side of the block. I'm not sure if its a model issue or a Forge one.

I don't want to work on the final texture as model changes may be needed.

 

Edit:

Had an idea, the faces that have the incorrect shading are outside of a single block bounds by 1/16 of a block.

I'll need to adjust one of the parts to test, but if that's the issue, it will be both nice to have solved and suck because my design will need to be changed.

 

Edit2:

Moving the parts back so they are inside of the block, corrected most of the improper shading, just some weirdness with the outside border. (could be a rounding issue causing it to be a hair out of the block still)

 

I gave a few other things a go:

-- useNeighborBrightness ; nope, it looks very bad.

-- setting the "ambient" flag to false; fixes the shading but causes the edges of other parts to turn black

 

Looks like the shader doesn't work with a opaque model that is bigger then a block. The model needs to be remade.

 

'Fix'

The shader doesn't like blocks bigger then one Minecraft bock.

So the model was resized to fit within a Minecraft block.

 

The odd shading still present after the downsize appears to be a float rounding error

I had to change matrix.setTranslation(new Vector3f(0.5F, 0.5F, 0.5F)); to matrix.setTranslation(new Vector3f(0.5001F, 0.5001F, 0.5001F));

 

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 cant craft any of the epic fight mod weapons. I try using the recipes in the crafting table but nothing is working. and when i click on the epic fight weapon in jei there is no recipe at all.
    • Oklahoma Nation Cowboys at Youngstown Country PenguinsYoungstown, Ohio; Wednesday, 7 p.m. EDTBOTTOM LINE: The Youngstown Region Penguins facial area the Oklahoma Country Cowboys within the Countrywide Invitation Penguins include absent 15-5 versus Horizon League rivals, with a 9-4 history within non-meeting participate in. Youngstown Region is 1-2 inside online games resolved as a result of considerably less than 4 facts. The Cowboys are 8-10 in just Massive 12 engage in. Oklahoma Region ranks 9th within just the Large 12 taking pictures 31.1% towards 3-stage wide PERFORMERS: Dwayne Cohill is averaging 17.8 details and 4.8 helps for the Penguins. Adrian Nelson is averaging 17.1 info higher than the remaining 10 game titles for Youngstown Thompson is averaging 11.7 details for the Cowboys. Caleb Asberry is averaging 13.1 facts about the very last 10 video games for Oklahoma last 10 Video games: Penguins: 7-3 Zeke Zaragoza Jersey, averaging 79.7 info, 33.4 rebounds, 14.8 helps, 5.3 steals and 2.7 blocks for each video game despite the fact that capturing 48.1% versus the marketplace. Their rivals incorporate averaged 72.4 details for every : 4-6, averaging 66.4 specifics, 33.1 rebounds, 11.1 helps Jake Henry Jersey, 4.9 steals and 3.6 blocks for each sport even though taking pictures 41.3% towards the sector. Their rivals consist of averaged 72.0 info. The made this tale making use of technological innovation delivered by means of Information and facts Skrive and info against Sportradar. Cowboys Shop
    • Oklahoma Nation Cowboys at Youngstown Country PenguinsYoungstown, Ohio; Wednesday, 7 p.m. EDTBOTTOM LINE: The Youngstown Region Penguins facial area the Oklahoma Country Cowboys within the Countrywide Invitation Penguins include absent 15-5 versus Horizon League rivals, with a 9-4 history within non-meeting participate in. Youngstown Region is 1-2 inside online games resolved as a result of considerably less than 4 facts. The Cowboys are 8-10 in just Massive 12 engage in. Oklahoma Region ranks 9th within just the Large 12 taking pictures 31.1% towards 3-stage wide PERFORMERS: Dwayne Cohill is averaging 17.8 details and 4.8 helps for the Penguins. Adrian Nelson is averaging 17.1 info higher than the remaining 10 game titles for Youngstown Thompson is averaging 11.7 details for the Cowboys. Caleb Asberry is averaging 13.1 facts about the very last 10 video games for Oklahoma last 10 Video games: Penguins: 7-3 Zeke Zaragoza Jersey, averaging 79.7 info, 33.4 rebounds, 14.8 helps, 5.3 steals and 2.7 blocks for each video game despite the fact that capturing 48.1% versus the marketplace. Their rivals incorporate averaged 72.4 details for every : 4-6, averaging 66.4 specifics, 33.1 rebounds, 11.1 helps Jake Henry Jersey, 4.9 steals and 3.6 blocks for each sport even though taking pictures 41.3% towards the sector. Their rivals consist of averaged 72.0 info. The made this tale making use of technological innovation delivered by means of Information and facts Skrive and info against Sportradar. Cowboys Shop
    • DUTA89 agen slot online terbaik dan sering memberikan kemenangan kepada setiap member yang deposit diatas 50k dengan tidak klaim bonus sepeser pun.   Link daftar : https://heylink.me/DUTA89OFFICIAL/  
    • Hello All! Started a MC Eternal 1.6.2.2 server on Shockbyte hosting. The only other mod I added was betterfarmland v0.0.8BETA. Server is 16GB and Shockbyte wont tell me how many CPU cores i have.  We are having problems now when players log in it seems to crash the server. At other times it seems fine and we can have 3 people playing for hours at a time. Usually always when it does crash it is when someone logs in. Crash Reports Below. To the person who can post the fix I will reward $100 via Paypal.   ---- Minecraft Crash Report ---- // This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~] Time: 2024-09-19 21:04:58 UTC Description: Exception in server tick loop java.lang.StackOverflowError     at net.minecraft.advancements.PlayerAdvancements.hasCompletedChildrenOrSelf(PlayerAdvancements.java:451)     at net.minecraft.advancements.PlayerAdvancements.shouldBeVisible(PlayerAdvancements.java:419)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:385)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:406)     at net.minecraft.advancements.PlayerAdvancements.ensureVisibility(PlayerAdvancements.java:411)     at net.minecraft.advancements.P  
  • Topics

×
×
  • Create New...

Important Information

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