c++ – DirectX 11 Sprite Alpha (Invalid? + Bad Quality)

This is a rather odd setup for blend state:

// Default values
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;

// Blend setup
desc.RenderTarget[0].BlendEnable = TRUE;
desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_INV_DEST_ALPHA;
desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;

Typically you’d use the following for ‘straight’ alpha:

// Blend setup
desc.RenderTarget[0].BlendEnable = TRUE;
desc.RenderTarget[0].SrcBlend =
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
desc.RenderTarget[0].DestBlend =
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;

And use this for premultiplied alpha:

// Blend setup
desc.RenderTarget[0].BlendEnable = TRUE;
desc.RenderTarget[0].SrcBlend =
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
desc.RenderTarget[0].DestBlend =
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;

And this for additive:

// Blend setup
desc.RenderTarget[0].BlendEnable = TRUE;
desc.RenderTarget[0].SrcBlend =
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
desc.RenderTarget[0].DestBlend =
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;

Unity 2d Sprite Swap Help

i know that that’s is a very old unity issue. I’m doing a 2d pixel art rpg and i want to sprite swap whenever the player gets an armor (helmet,vest,boots…). I created an empty gameobject and childed all armor gameobject.
After a long research i found the Unity Sprite Library Asset that can swap the sprites of a category. I have a helmet idle sprites and registering this to the sprite library i can succesfully swap the head helmet. The problem is that when i animate this, i can’t swap the sprites because the animations keyframes animates only one sprite.

Is there a way to help with my code?

unity – How many Sprite Atlases should be used?

I am using Sprite Atlases in my game to fix a bug with gaps between tiles as a result of oversampling, and I started wondering how the atlases should be used.

What I’m asking here is whether I should use one atlas for all of the sprites, use multiple atlases as categories of some sort, or only use them with images with multiple sprites (to fix the bug).

java – Delayed rendering of object sprite

I’m trying to replicate an odd feature of an 2.5D online Fighting Game named Grand Chase – that I believe it’s is made to hide the latency between players. However, I do not know what exactly is this technique/feature, or if masking the lag is it’s real objective.

What matters is: It adds an visual input-lag for the player that does not exist, but it creates interesting out-of-sync situations that enable different player techniques that is unique on this game.

How it works:

This delayed rendering is applied to all actions except for when the character is being hit – the flinch/pain animation starts at the very same frame the game detects the collision.

This delayed feature is only applied to the player’s character. Other players on the match, both object/hurtboxes/hitboxes are in sync with the rendered character model and animations.

So, it only works for the player, not the opponents/allies.

When an input is made, the character object reacts instantly to whatever the desired action of said input, however the 3d mesh of the caracter are delayed for exactly 8 frames.

Example – a simple jab attack that has 3 frames of startup would play like this:

Press the key for the jab on frame 0 – the game already sends the attack player over the network for connected clients.

On frame 3, the character hitbox is now alive and collides with other object. Enemy character is already on the first frame of flinch/pain animation, However, the player charater is still on idle animation. Damage dealt is displayed, and HP is reduced from the target.
On frame 4, the particle effects of hit collision starts to be rendered where the hitboxes collided. Character is still on idle animation.
On Frame 8, character is no longer on idle animation, and is on the first frame of jab animation.
On frame 11, character is then stopped due to hitlag/hitstagger effect – this is when the player visually confirms that his hit has been confirmed.

Another example – Movement and taking damage

Frame 0 – Game confirms the dash input, so the object and hurtbox is already moving forward. The character model is still standing in place, on idle animation.
8 Frames later, then, the character switches from idle animation to the dashing animation and starts to move on screen.

When the character is moving fast and is hit by an attack/projectile going towards the character, the collision visual effect is displayed ahead of the character (it spawns where the hitboxes collided), the character animation instantly switches to the flinch/pain animation, where the character still goes forward for 8 frames, then stand still.

So, in reality, the player character object is updated in real time, only the character model is updated 8 frames later.

Anyone knows if there is any documentation on this?

I’m trying to replicate this for my own game on an self made Java 2D engine. On my engine, the object updates it’s state class responsible for movement/hitboxes/animation handling then, right after all states are updated, it calls the render function.

Ive tried buffering character X and Y coordinates for 8 frames, it kinda worked but i’ve failed when trying to buffer the animation frames, since it is updated on the state class, not on render function. Any tips are welcome!

unity – how to check if sprite is fully masked

enter image description here

i want my player use as a mask and when he go up of the sprite, the section of that sprite will be masked. when the full image is mask i want to give a pop up like “completed”.my main problem is i dont know how to know if the sprite is fully masked..one more problem is some parts of that sprite is alpha/transparent..i want to ignore alpha as completed

opengl – rotate sprite without stretching

I am attempting to rotate the sprites in my game, but they get stretched whenever it happens. I know that it is due to the screen not being square, but I can not figure out the correct way to compensate for that.

enter image description here
enter image description here

The left was taken from a non square screen, and the right is from a square screen. I need to scale it in a way that it will be normal again.
The code that I am using to move and rotate the sprites is below:

glm::mat4 temp = glm::mat4(1.0f);
float angle = glm::radians(45.0f);
temp = glm::scale(temp, glm::vec3(xScale,yScale, zScale));
temp = glm::rotate(temp, angle, glm::vec3(0f, 0f, 0f));
temp = glm::translate(temp, glm::vec3(coor(0), coor(1), 0.0f));
trans = temp;

coor is just the new coordinate to move the sprite to. What is an equation that can get me the X,Y,and Z Scale? I have access to the screen aspect ratio, and I know it has something to do with it. I tried multiplying it by the screen ratio, but that didn’t work. I multiplied them by the sin and cos of the angle, but that didn’t work either. What is an equation that works?

dnd 5e – Can an ally or familiar with opposable thumbs (Imp, Sprite) doff and/or don the player’s shield for them?

The short answer is that it is up to the DM. I couldn’t find any supporting rules specifically about getying help into or out of armor. However….
Climb onto bigger creatures

As an alternative, a suitably large opponent can be treated as terrain for the purpose of jumping onto its back or clinging to a limb.

This rule allows small creatures to climb onto you and at least attempt to buckle the shield in place.

Doff and Don armor
Says:

Don. This is the time it takes to put on the item. You benefit from it’s AC only if you take the full time to don it.

Doff. This is the time it takes to take off the item. If you have help removing armor, reduce this time by half.

So at the very least they can help.