Jump to content

make building system


iwalidza

Recommended Posts

Hello iwalidza,

this "building system" appears to be a database of 3D objects as well as their 3D attachment-points. There are mathematics involved to calculate the orientation and positioning of items. I suggest that you start envisioning what points there are, in what relation they are in GTA SA local model space of each object and how to use the vector and rotation mathematics to get the desired result. You will need to use a line-of-sight check along with evaluation of the target location surrounding to check what attachment point to select based on the available ones of the current construction. I believe that you also cannot go without a Lua information structure about the current structures, their attachment-points and what attachment-points are already taken by which item. You need to have a good perception of the visual space to understand. But you can get to it iteratively by doing it in the following steps:

  1. accumulate a set of assets to use for your building system
  2. register the assets in your custom database, along with the attachment points and their supported attachments
  3. write MTA test commands to spawn fixed constructions with attachments at predetermined locations
  4. think of an algorithm to select the most-desired attachment-point previously unused for the object currently-to-be-attached by the requested user mouse ray
  5. extend the system to be click based building block just like in the video

Since this seems like a lot of work to do, do not expect a premade system being handed to you that fits all your desires. But I am sure that, if given enough motivation, it is possible to pull off inside MTA.

Good luck! ?

Edited by The_GTA
  • Thanks 1
Link to comment
23 hours ago, The_GTA said:

Hello iwalidza,

this "building system" appears to be a database of 3D objects as well as their 3D attachment-points. There are mathematics involved to calculate the orientation and positioning of items. I suggest that you start envisioning what points there are, in what relation they are in GTA SA local model space of each object and how to use the vector and rotation mathematics to get the desired result. You will need to use a line-of-sight check along with evaluation of the target location surrounding to check what attachment point to select based on the available ones of the current construction. I believe that you also cannot go without a Lua information structure about the current structures, their attachment-points and what attachment-points are already taken by which item. You need to have a good perception of the visual space to understand. But you can get to it iteratively by doing it in the following steps:

  1. accumulate a set of assets to use for your building system
  2. register the assets in your custom database, along with the attachment points and their supported attachments
  3. write MTA test commands to spawn fixed constructions with attachments at predetermined locations
  4. think of an algorithm to select the most-desired attachment-point previously unused for the object currently-to-be-attached by the requested user mouse ray
  5. extend the system to be click based building block just like in the video

Since this seems like a lot of work to do, do not expect a premade system being handed to you that fits all your desires. But I am sure that, if given enough motivation, it is possible to pull off inside MTA.

Good luck! ?

how I can make this shader I don't have any idea about shaders.

https://prnt.sc/26c77mh

Edited by iwalidza
Link to comment
1 hour ago, iwalidza said:

how I can make this shader I don't have any idea about shaders.

https://prnt.sc/26c77mh

This looks like the original 3D rendering has been given a very bright green tint. Imagine that a so-called "pixel shader" is setting the final color of each pixel that was calculated for each triangle of a 3D model. Then you can change this color by multiplying it into a very bright green color range. The simplest way to achieve this is to calculate the brightness of the pixel and then translate that into the green channel, leaving red and blue at zero.

brightness [example def.] = ( red + green + blue ) / 3

green = brightness, red = 0, blue = 0

It is really worth it to learn HLSL! This visual mathematics language will open your mind about the computational powers of the GPU. Are you really sure that you do not want to try your own hand at it? In that case I will give an example.

Link to comment
15 hours ago, The_GTA said:

This looks like the original 3D rendering has been given a very bright green tint. Imagine that a so-called "pixel shader" is setting the final color of each pixel that was calculated for each triangle of a 3D model. Then you can change this color by multiplying it into a very bright green color range. The simplest way to achieve this is to calculate the brightness of the pixel and then translate that into the green channel, leaving red and blue at zero.

brightness [example def.] = ( red + green + blue ) / 3

green = brightness, red = 0, blue = 0

It is really worth it to learn HLSL! This visual mathematics language will open your mind about the computational powers of the GPU. Are you really sure that you do not want to try your own hand at it? In that case I will give an example.

i have bad English language then it's so hard to learn

  • Sad 1
Link to comment
2 hours ago, iwalidza said:

i have bad English language then it's so hard to learn

In that case let me provide a template to you. I hope that it can be of help to you as a starting point. Also I am unaware of your language and why you are not trying the language specific subforum that fits you best, anyway.

struct VSInput
{
    float3 Position : POSITION;
    float4 Diffuse  : COLOR0;
    float2 TexCoord : TEXCOORD0;
};

struct VSOutput
{
    float4 Position : POSITION0;
    float2 TexCoord : TEXCOORD0;
    float4 Diffuse : COLOR0;
};

VSOutput VS( VSInput vin )
{
    VSOutput vout;
    vout.Color = vin.Color;
    vout.Position = vin.Position;
    vout.TexCoord = vin.TexCoord;
    return vout;
}

float4 PS( VSOutput pin ) : COLOR0
{
    float brightness = ( pin.Diffuse.r + pin.Diffuse.g + pin.Diffuse.b ) / 3;
    
    float4 color_out;
    color_out.r = brightness;
    color_out.g = brightness;
    color_out.b = brightness;
    color_out.a = pin.Diffuse.a;
    
    return color_out;
}

// TODO: put the technique along with it's passes here.

You still have to finish up that HLSL code above, with the general gist being implemented already (untested). Then you still have to put into motion the Lua side of things where you attach shaders using the engineApplyShaderToWorldTexture function.

This is how the world works, friend. Education is very important.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...